From owner-freebsd-questions Tue Sep 25 19: 3:25 2001 Delivered-To: freebsd-questions@freebsd.org Received: from cx344940-a.meta1.la.home.com (cx344940-a.meta1.la.home.com [24.6.21.74]) by hub.freebsd.org (Postfix) with ESMTP id BA9F537B413 for ; Tue, 25 Sep 2001 19:03:21 -0700 (PDT) Received: (from conrads@localhost) by cx344940-a.meta1.la.home.com (8.11.6/8.11.6) id f8Q23F482431; Tue, 25 Sep 2001 21:03:15 -0500 (CDT) (envelope-from conrads) Message-ID: X-Mailer: XFMail 1.5.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20010926111238.C99595@k7.mavetju.org> Date: Tue, 25 Sep 2001 21:03:14 -0500 (CDT) Organization: @Home Network From: Conrad Sabatier To: Edwin Groothuis Subject: Re: if then statement with grep Cc: FreeBSD Questions , BSD Freak 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 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 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