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

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

possible bug in egrep (GNU grep) 2.4.2


From: Miguel Angelo Rozsas
Subject: possible bug in egrep (GNU grep) 2.4.2
Date: 03 Apr 2002 19:30:23 +0100

Hi !

        I am using the exit code from egrep to decide if I have a match or not.
I am using csh, so the exit code is in $?.

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.

address@hidden tmp]$ cat > otherfile
John
Dude
address@hidden tmp]$ cat otherfile | egrep -i  -q miguel ; echo $?
1
address@hidden tmp]$ cat otherfile | egrep -i -v -q miguel ; echo $?
0

        In the last example, I think egrep -v must have to return 1 to indicate
there is not such pattern in the input. The -v flag must invert the
sense of matching, but not the return code. 

        I don't know what is the definition for egrep's exit code, but I think
the things are a bit confusing here.....

        Am I wrong ?


        best regards from Brazil,

PS: Sorry any mistake in my text. English isn't my native language.
        



        
 



reply via email to

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