From owner-freebsd-questions Fri Oct 31 03:51:05 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id DAA00559 for questions-outgoing; Fri, 31 Oct 1997 03:51:05 -0800 (PST) (envelope-from owner-freebsd-questions) Received: from beta.mep.ruhr-uni-bochum.de (beta.mep.ruhr-uni-bochum.de [134.147.6.3]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id DAA00551 for ; Fri, 31 Oct 1997 03:50:58 -0800 (PST) (envelope-from roberte@beta.mep.ruhr-uni-bochum.de) Received: (from roberte@localhost) by beta.mep.ruhr-uni-bochum.de (8.8.5/8.8.5) id MAA26262; Fri, 31 Oct 1997 12:50:47 +0100 (MEZ) From: Robert Eckardt Message-Id: <199710311150.MAA26262@beta.mep.ruhr-uni-bochum.de> Subject: Re: Potential bug in 'grep' In-Reply-To: <199710310449_MC2-2642-E24F@compuserve.com> from Malcolm Boff at "Oct 31, 97 04:49:16 am" To: Malcolm_Boff@compuserve.com (Malcolm Boff) Date: Fri, 31 Oct 1997 12:50:47 +0100 (MEZ) Cc: freebsd-questions@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL31H (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > I have been checking out a pre-release set of software (GNU) and which > uses a function in a shell script to determine whether or not the 'echo' > command > supports the '-e' flag (on FreeBSD it doesn't). It doesn't ? 12:45 beta: /home/roberte 0% tcsh 12:45 beta: /home/roberte 0% (echo -e) | sed s/-e/xe/ | grep xe; echo $? xe 0 12:46 beta: /home/roberte 0% echo -e -e 12:47 beta: /home/roberte 0% sh $ (echo -e) | sed s/-e/xe/ | grep xe; echo $? 1 $ echo -e $ > To cut a long story short try the following :- > > (echo -e) | sed s/-e/xe/ | grep xe; echo $? > > here sed returns 'xe' and therefore should satisfy a match with 'grep' and > should return '0' but it returns a '1' (no match ?). > > I think this is a 'bug' anyone agree ?? No. :-) Robert -- Dr. Robert Eckardt ( Ruhr-Universitaet Bochum, Inst.f.Theor.Physik, NB6/169 ) Universitaetsstrasse 150, D-44780 Bochum, Germany ----X---8---- Telefon: +49 234 700-3709, Telefax: +49 234 7094-574 8 E-Mail: RobertE@MEP.Ruhr-Uni-Bochum.de --------8---- URL: http://WWW.MEP.Ruhr-Uni-Bochum.de/~roberte >>> A magician never reveals his secret: the unbelievable trick becomes <<< >>> simple and obvious once it is explained. <<<