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

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

Re: grep -v exit status constantly zero


From: Harri Järvi
Subject: Re: grep -v exit status constantly zero
Date: Tue, 16 Sep 2008 08:42:22 +0300
User-agent: Icedove 1.5.0.12 (X11/20070607)

Paul Jarc wrote:
Harri Järvi <address@hidden> wrote:
In practice the exit value seems to be 0 (zero) in every case with the
"-v" option.

The 2.5.3 info documentation says:
# Normally, the exit status is 0 if selected lines are found and 1
# otherwise.

With -v, non-matching lines are selected for output.  If there are no
selected lines (with -v, this means that all input lines match the
regexp), then the status is 1.

$ echo foo | grep -v foo; echo $?
1

Ah, ok. My mistake. I was thinking something else...

I think this is correct after all. At least it's consistent with what the documentation for GNU grep says. It just wasn't immediately obvious for me. Sorry.

Yours,
Harri




reply via email to

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