Ping error? Invalid Argument
-
Hello .. Good evening! I created a command, but it is giving "
ping: invalid argument: '192.168.0.1'
I built this code:
#!/bin/bashfor ip in $(seq 1 20); of
ping -c $1.$ip | grep "64 bytes" | cut -d " " -f 4
done
Can someone help me?
-
-
Where are you trying to run it?
-
@stephenw10 Kali Linux! 2022
-
Looks like it's trying to use the IP address as the ping count. Like:
steve@steve-NUC9i9QNX:~$ ping -c 192.168.0.1 ping: invalid argument: '192.168.0.1'
-
Better late than never.........
I had a similar issue and noticed that you didn't have a number '1' after -c (presuming that you only wanted it to ping once): -c 1
Maybe that would work.
Cheers.