Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Sep 2001 21:03:14 -0500 (CDT)
From:      Conrad Sabatier <conrads@home.com>
To:        Edwin Groothuis <edwin@mavetju.org>
Cc:        FreeBSD Questions <freebsd-questions@FreeBSD.ORG>, BSD Freak <bsd-freak@mbox.com.au>
Subject:   Re: if then statement with grep
Message-ID:  <XFMail.20010925210314.conrads@home.com>
In-Reply-To: <20010926111238.C99595@k7.mavetju.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 26-Sep-2001 Edwin Groothuis wrote:
> On Wed, Sep 26, 2001 at 10:56:43AM +1000, BSD Freak wrote:
>> if `grep "expected line" /var/log/mylogfile` does NOT return something
>> then
>> mail -s "Alert" me@mycompany.com
>> otherwise don't bother me
> 
> if [ ! -z "`grep "expected line" /var/log/mylogfile`" ]; then
>       ... do your stuff here ...
> fi

Actually, a simple "if ! grep ..." should do the same thing.

----------------------------------
E-Mail: Conrad Sabatier <conrads@home.com>
Date: 25-Sep-2001
Time: 21:01:59

This message was sent by XFMail
----------------------------------

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?XFMail.20010925210314.conrads>