On Tue, Sep 16, 2008 at 8:52 AM, Jim Cheetham <[EMAIL PROTECTED]> wrote: > On Mon, Sep 15, 2008 at 9:29 PM, Chris Hellyar <[EMAIL PROTECTED]> wrote: >> #!/bin/bash >> echo -n " OK " >> date >> echo -n " " >> cat /tmp/pingouttxt | grep time= | cut -d "=" -f 4 > > printf is nice, but over the top. You just need to get all the data > into a single invocation of echo ... > > echo "OK $(date) $(cat /tmp/pingouttxt|grep time=|cut -d "=" -f 4)"
Two comments:- The script should also take into account the real-world fact that ping returns a value of 2 if the host is not in the DNS. Also, imho, while in this case it's probably somewhat moot, the use of files in /tmp is often considered a security risk. The use of a shell variable is to be preferred. -- Sincerely etc. Christopher Sawtell
