[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: grep -v exit code on empty files
From: |
Alexandre Duret-Lutz |
Subject: |
Re: grep -v exit code on empty files |
Date: |
Thu, 29 Jul 2004 13:36:00 +0200 |
On Thu, Jul 29, 2004 at 12:13:45PM +0100, David Jones wrote:
> 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.)
This wording was fixed in grep 2.5. -v inverts the sense of matching,
not that of the exit status.
When the input file is empty, searching for lines that contains e or
for lines that do not contains e always fails, hence the exit code.