Skip to content

Instantly share code, notes, and snippets.

@g-liu
Created July 4, 2015 20:00
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 g-liu/85b6edb43fa0c4a05592 to your computer and use it in GitHub Desktop.
Save g-liu/85b6edb43fa0c4a05592 to your computer and use it in GitHub Desktop.
Ping with timestamp
#!/bin/bash
HOST=$@
ping $HOST | while read PONG
do
grep -q ttl <<< "$PONG"
if [ $? -eq 0 ]; then
echo "`date`: $PONG"
else
echo "$PONG"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment