bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: possible bug in egrep (GNU grep) 2.4.2


From: Paul Jarc
Subject: Re: possible bug in egrep (GNU grep) 2.4.2
Date: Wed, 03 Apr 2002 16:05:11 -0500
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/20.7 (i386-redhat-linux-gnu)

Miguel Angelo Rozsas <address@hidden> wrote:
> address@hidden tmp]$ cat > somefile
> John
> Miguel
> Dude
> address@hidden tmp]$ cat somefile | egrep -i -q miguel; echo $?
> 0
> address@hidden tmp]$ cat somefile | egrep -i -v -q miguel; echo $?
> 0
>       Theses are fine, because the pattern miguel is present in the input.

Actually, since -v also toggles the exit code to match the output, the
reason for 0 in the second case is not that there was a line "Miguel",
but rather that there were also lines that did *not* contain "Miguel".
This becomes clearer without -q:
$ { echo John; echo Miguel; echo Dude; }|egrep -i -v miguel; echo $?
John
Dude
0
$ echo Miguel|egrep -i -v miguel; echo $?
1


paul



reply via email to

[Prev in Thread] Current Thread [Next in Thread]