From owner-freebsd-questions Tue Sep 25 18:13:31 2001 Delivered-To: freebsd-questions@freebsd.org Received: from topaz.mdcc.cx (topaz.mdcc.cx [212.204.230.141]) by hub.freebsd.org (Postfix) with ESMTP id C227937B40E for ; Tue, 25 Sep 2001 18:13:28 -0700 (PDT) Received: from k7.mavetju.org (topaz.mdcc.cx [212.204.230.141]) by topaz.mdcc.cx (Postfix) with ESMTP id 66CD42B72F; Wed, 26 Sep 2001 03:13:13 +0200 (CEST) Received: by k7.mavetju.org (Postfix, from userid 1001) id AEA8960; Wed, 26 Sep 2001 11:12:38 +1000 (EST) Date: Wed, 26 Sep 2001 11:12:38 +1000 From: Edwin Groothuis To: BSD Freak Cc: FreeBSD Questions Subject: Re: if then statement with grep Message-ID: <20010926111238.C99595@k7.mavetju.org> Mail-Followup-To: Edwin Groothuis , BSD Freak , FreeBSD Questions References: <9131a6912c7d.912c7d9131a6@mbox.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <9131a6912c7d.912c7d9131a6@mbox.com.au>; from bsd-freak@mbox.com.au on Wed, Sep 26, 2001 at 10:56:43AM +1000 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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