Ping test in a shell script

#!/bin/sh
 
# -q quiet
# -c nb of pings to perform
 
ping -q -c5 google.com > /dev/null
 
if [ $? -eq 0 ]
then
	echo "ok"
fi
 

Feedback

Great! Thank you very much!
Danilo Castro de Souza
Jan 17, 2012
#1
It Helped;-) Thanks
Navid
Nov 30, 2012
#2
works !!! ... thanks :D
Ruwan
Dec 9, 2012
#3
#!/bin/bash

for i in $( cat $HOME/iplist )
do
ping -q -c2 $i > /dev/null

if [ $? -eq 0 ]
then
echo $i "Pingable"
else
echo $i "Not Pingable"
fi
done
Kalyan
Mar 15, 2013
#4