jdgold

Distance to Home Geeklet

Oct 6th, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.23 KB | None | 0 0
  1. HOST=YOUR_IP_OR_HOSTNAME_HERE
  2. PING=`ping -q -c 1 $HOST`
  3. if [[ $? -eq 0 ]] ; then
  4.     TIME=`echo $PING |tail -1 | cut -d/ -f 5`
  5.     echo ${TIME}ms away from home
  6.     exit 0
  7. else
  8.     echo home could not be reached
  9.     exit 2
  10. fi
Advertisement
Add Comment
Please, Sign In to add comment