Date: Wed, 26 Sep 2001 11:12:38 +1000 From: Edwin Groothuis <edwin@mavetju.org> To: BSD Freak <bsd-freak@mbox.com.au> Cc: FreeBSD Questions <freebsd-questions@FreeBSD.ORG> Subject: Re: if then statement with grep Message-ID: <20010926111238.C99595@k7.mavetju.org> In-Reply-To: <9131a6912c7d.912c7d9131a6@mbox.com.au>; from bsd-freak@mbox.com.au on Wed, Sep 26, 2001 at 10:56:43AM %2B1000 References: <9131a6912c7d.912c7d9131a6@mbox.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
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 For the -z explanation, see the man page of test. Edwin -- Edwin Groothuis | Personal website: http://www.MavEtJu.org edwin@mavetju.org | Interested in MUDs? Visit Fatal Dimensions: ------------------+ http://www.FatalDimensions.org/ 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?20010926111238.C99595>