Shakthi Kannan wrote:
,----
| #!/bin/bash
| ping -c 1 www.yahoo.com 1>/dev/null
| return=`echo $?`
| if [ $return -eq 0 ]; then #Success
| echo "0" >> /tmp/log.file
| else #Failure
| echo "1" >> /tmp/log.file
| fi
`----
Or simply:
ping -c 1 $host 2>&>/dev/null && echo 1 || echo 0 >>/tmp/log.file
cheers,
-Suraj
--
,-----------------[http://www.symonds.net/~suraj/]---o
| Zakir Hussain is best known for his tabla playing virtuosity, however, he can
| be heard singing in the soundtrack of the film "Mr. and Mrs. Iyer", which he
| scored. The song features Zakir and Ustad Sultan Khan on vocals.
`------------------------------[suraj@xxxxxxxxxxx]---o