1

I'm absolutely horrible at scripting. Never really done it before. I've been asked to create a script for a class project and have no idea where to start. Here are the requirements:

Create a simple script on the client to request the user to supply a numeric value (X) and then ping each IP address starting from 192.168.222.1 to 192.168.222.X :

  • The value could be provided to the script as a command line parameter or read from the keyboard when prompted
  • A conditional expression should be used to evaluate when all needed IP addresses have been pinged
  • The script should ping each IP address starting from 192.168.222.1 and ending at 192.168.222.X.
  • The script should display text saying “Beginning scan of 192.168.222.X ….” followed by the output of the ping command of the current IP addresses
  • Use an appropriate ping parameter to only send two ping echos to each host
  • Run the script with an input value of 15 and show the results.

Any help would be much appreciated.

Danny E.

Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497
  • This is not the place to get help with the most basic of scripting questions for a class. You need to talk to your instructor and find out why you know so little about the task. But first, I'd suggest you write down the logical steps in the process THEN you look at the commands needed. For example, read and parse it for an input value; is it there?; If not, prompt for it; read it in; now check if the value passed or read in is a positive numeric? If not, reprompt; if so then ... That's the logical design. THEN you look for commands that will do those steps. – jpezz Dec 03 '17 at 02:08
  • Proper way to do things is via nmap command, so your assignment for class is redundant and not what actually would be done in practice, but that's typical in educational setting. Anyway, see the linked duplicate. There's answer on how to do it properly, and there's a shell script answer with ping which matches your requirements. – Sergiy Kolodyazhnyy Dec 03 '17 at 02:15
  • 1
    In addition to what jpezz has already said, another reason for not getting help with homework on forums is that the answers you might get may be very different from what's taught in class. A teacher that knows what s/he is doing can spot that you got external help. You really should talk to your instructor. – Ray Dec 03 '17 at 05:49

0 Answers0