Execute this by:
(777 might be an over kill for this one) sudo chmod 777 available_ip.sh
./available_ip.sh
Execute this by:
(777 might be an over kill for this one) sudo chmod 777 available_ip.sh
./available_ip.sh
#!/bin/sh | |
# Uncomment for debugging | |
#set -x | |
pingf(){ | |
if ping -w 2 -q -c 1 192.168.1."$1" > /dev/null ; | |
then | |
printf "IP %s is up\n" 192.168.1."$1" | |
else | |
printf "IP %s is open\n" 192.168.1."$1" | |
fi | |
} | |
main(){ | |
NUM=1 | |
while [ $NUM -lt 255 ];do | |
pingf "$NUM" & | |
NUM=$(expr "$NUM" + 1) | |
done | |
wait | |
} | |
main |