Created
July 4, 2015 20:00
-
-
Save g-liu/85b6edb43fa0c4a05592 to your computer and use it in GitHub Desktop.
Ping with timestamp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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