Skip to content

Instantly share code, notes, and snippets.

@johanmeiring
Created August 8, 2013 08:28
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 johanmeiring/6182729 to your computer and use it in GitHub Desktop.
Save johanmeiring/6182729 to your computer and use it in GitHub Desktop.
Ping a subnet and record reachable IPs in a file.
#!/bin/bash
COUNTER=1
rm ips
while [[ $COUNTER -lt 255 ]]; do
ping 192.168.254.$COUNTER -c 1 -W 1 && echo "192.168.254.$COUNTER" >> ips
COUNTER=$(( $COUNTER + 1 ))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment