Skip to content

Instantly share code, notes, and snippets.

@prameshbajra
Created January 7, 2020 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prameshbajra/fdefa5588c158df170880165a01f2f3e to your computer and use it in GitHub Desktop.
Save prameshbajra/fdefa5588c158df170880165a01f2f3e to your computer and use it in GitHub Desktop.
Gives the list of IPs that are Busy or Open.
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment