bug-grep
[Top][All Lists]
Advanced

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

bug#37716: grep exit status with -L redirected to /dev/null


From: Adam Sampson
Subject: bug#37716: grep exit status with -L redirected to /dev/null
Date: Sat, 12 Oct 2019 15:22:05 +0100
User-agent: Mutt/1.12.2 (2019-09-21)

Hi grep maintainers,

This behaviour, with grep 3.3 built from source, is a bit surprising:

$ echo hello >thing
$ grep -L goodbye thing && echo OK
thing
OK
$ grep -L goodbye thing >/dev/null && echo OK
$

That is, when using -L, redirecting stdout to /dev/null has the same
effect on the exit code as specifying -q (the behaviour with -q is
described in the "Exit Status" section of the manual). This is a bit
awkward if you're using grep in a script, because you don't necessarily
have any control over whether stdout is /dev/null or not.

Cheers,

-- 
Adam Sampson <address@hidden>                         <http://offog.org/>





reply via email to

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