Beautiful! We were just talking about this and someone mentioned grep -v but
now I know how to use it too.
Thanx Much!
Anil Gupte
www.keeninc.net
www.icinema.com
----- Original Message -----
From: "Michael Marsh" <[EMAIL PROTECTED]>
To: <debian-user@lists.debian.org>
Sent: Tuesday, May 16, 2006 5:21 PM
Subject: Re: Learning Scripting
On 5/16/06, Anil Gupte <[EMAIL PROTECTED]> wrote:
The idea was the system cannot start the X-Server sometimes when the power
goes
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
in
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
try:
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
http://www.umiacs.umd.edu/~mmarsh
http://mamarsh.blogspot.com
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]