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

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

grep -v exit code on empty files


From: David Jones
Subject: grep -v exit code on empty files
Date: Thu, 29 Jul 2004 12:13:45 +0100

The man page for grep claims:

Normally, exit status is 0 if matches were found, and 1 if  no  matches
were  found.   (The  -v  option  inverts the sense of the exit status.)


So since
: | grep e

exits with 1 (no matches found)
I would expect
: | grep -v e
to exit with 0 (-v inverts the sense).
But it doesn't.
: | grep -v e
exits with 1

Bug in grep or in the documentation? You decide. I can't decide. And I can't be bothered to trawl through the spec for an authoratative answer either.

Cheers,
 drj





reply via email to

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