[Ilugc] Shell scripting help

  • From: rohitbaisakhiya@xxxxxxxxx (Rohit Baisakhiya)
  • Date: Sun Jan 9 15:53:28 2005

On Sun, 9 Jan 2005 01:08:24 -0800, Suraj <suraj@xxxxxxxxxxx> wrote:

Shakthi Kannan wrote:

This script seems to work better for me. Anyway thanks for the help suraj.

,----
| #!/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
_______________________________________________
To unsubscribe, email ilugc-request@xxxxxxxxxxxxx with
"unsubscribe <password> <address>"
in the subject or body of the message.
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc



-- 
Regards,
Rohit Baisakhiya
KiranInfotech

Other related posts: