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

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

grep invert-match return code


From: Tavis Ormandy
Subject: grep invert-match return code
Date: Thu, 20 Apr 2006 11:38:22 +0100
User-agent: Mutt/1.5.11

POSIX says `grep -v` will "Select lines not matching any of
the specified patterns.", and the return code should be 1
if "No lines were selected.", however this doesnt seem to be
true in GNU grep:

$ printf "one\ntwo\nthree\n" | grep -v one; echo $?
two
three
0
$ printf "one\ntwo\nthree\n" | grep -v four; echo $?
one
two
three
0

both return 0, "One or more lines were selected", even though this
doesnt seem to be true in the second example, as no lines were
selected.

Sorry if I have misinterpreted the documentation.

-- 
-------------------------------------
address@hidden | finger me for my pgp key.
-------------------------------------------------------

Attachment: pgp7s2v3Kjm9W.pgp
Description: PGP signature


reply via email to

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