Code:
#!/bin/bash
for ((n=0 ; n < 254 ; n+=1))
do
ip=192.168.0.$n
if ping -c 1 -w 1 $ip > /dev/null 2> /dev/null >> /etc/logping.txt; then
echo "${ip} is up" # output up
# sintax >> /etc/logping.txt log with .txt format
else
echo "${ip} is down" # output down
fi
done
than i gave this out put
Code:
192.168.0.0 is down
192.168.0.1 is up
192.168.....
...
.
.
.
.
192.168.0.220
I want to also implement 2 arguments to this script
the argument xx-yy en -t
xx-yy a range of IP address when I give the parameter ./testping.sh 67-80 it scans the range between this IP addresses
-t counts the IP address with 200 for example, when I run the script with the parameter -t , ./testping.sh -t 17 , then I want as output 192.168.0.217