Re: Learning Scripting
Beautiful! We were just talking about this and someone mentioned grep -v but
now I know how to use it too.
----- Original Message -----
From: "Michael Marsh" <firstname.lastname@example.org>
Sent: Tuesday, May 16, 2006 5:21 PM
Subject: Re: Learning Scripting
On 5/16/06, Anil Gupte <email@example.com> wrote:
The idea was the system cannot start the X-Server sometimes when the power
off unexpectedly. So, if an error message is found the system should be
shutdown nicely and then when it reboots, it runs an fsck and cleans up.
The second set of checks is because sometimes the grep command itself appears
the ps ax, and we do not want to reboot for this spurious occurrence.
It looks like your script might generate false negatives, if the error
condition is there but grep shows up in ps. You might want to instead
check1=$(ps ax | grep -i "$msg1" | grep -v grep)
check2=$(ps ax | grep -i "$msg2" | grep -v grep)
You then shouldn't need check10 and check20. Another option would be
to test check10 and check20 against check1 and check2. I think the
above is probably better, though.
Michael A. Marsh