Created
March 17, 2015 20:34
-
-
Save akkaash/e59be9e71b667eb6e4de to your computer and use it in GitHub Desktop.
Ping multiple hosts and extract the average ping time
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
function do_ping(){ | |
echo $1 | |
ping -c 4 $1 | tail -1| awk '{print $4}' | awk -F '/' '{print $2}' | |
} | |
declare -a arr=("google.com" "facebook.com" "linkedin.com") | |
for i in "${arr[@]}" | |
do | |
do_ping "$i" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment