0

Good afternoon everyone I seem to be in quite the quandary. I'm trying to get a simple pingsweep to run yet there seems to be an issue I believe either with the undeclared variable using READ or well I have no clue. If I take the following line of script;

for i in {1..254}; do (ping -c1 $network.$i |grep "bytes from" | cut -d " " -f4 >> Live.txt &) ; done

and subtract the $network variable and add in a fixed data point the whole script works just fine. But if I attempt to run the lines in a script like the following I am hit with an error that I'll show below.

echo 'Enter your /24 network (like 10.10.10)'
read network
for i in {1..254}; do (ping -c1 $network.$i |grep "bytes from" | cut -d " " -f4 >> Live.txt &) ; done
;;

If I run that script I get the following error...

ping: 192.168.1.{1..254}: Name or service not known

Any suggestions? I'm trying to make a very simple pingsweep to show some students and I'd like just the IP's that are up to be piped into the .txt and again if I run the "for i" command by itself it works fine.

Christian Fritz
  • 18,961
  • 3
  • 42
  • 63
Surtr
  • 1

0 Answers0