Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Sep 2001 01:42:58 +0200
From:      Cliff Sarginson <cliff@raggedclown.net>
To:        Mike Meyer <mwm@mired.org>
Cc:        questions@freebsd.org, bsd-freak@mbox.com.au
Subject:   Re: if then statement with grep
Message-ID:  <20010929014258.A8586@raggedclown.net>
In-Reply-To: <15284.52053.233409.459906@guru.mired.org>; from mwm@mired.org on Fri, Sep 28, 2001 at 02:11:17PM -0500
References:  <25660940@toto.iv> <15284.52053.233409.459906@guru.mired.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Sep 28, 2001 at 02:11:17PM -0500, Mike Meyer wrote:
> Cliff Sarginson <cliff@raggedclown.net> types:
> > On Tue, Sep 25, 2001 at 09:03:14PM -0500, Conrad Sabatier wrote:
> > > On 26-Sep-2001 Edwin Groothuis wrote:
> > > > On Wed, Sep 26, 2001 at 10:56:43AM +1000, BSD Freak wrote:
> 
<snip>
> You can simplify even further if you ask grep nicely:
> 
> grep -q "expected line" /var/log/myfile" && echo KISS
> 
> This is even more efficient that the other solutions, as grep will
> stop on the first match and exit with success.
> 
> 	<mike
Ok.. except I recall he wants to do something if the line is not
found .. so he needs "||" instead of "&&" ....

-- 
Regards
Cliff



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010929014258.A8586>