GNU bug report logs - #30105
Additional "grep" parameter to change the exit code from 1 to 0, even if grep doesn't find pattern

Previous Next

Package: grep;

Reported by: Vasyl Vavrychuk <vvavrychuk <at> gmail.com>

Date: Sun, 14 Jan 2018 05:57:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Vasyl Vavrychuk <vvavrychuk <at> gmail.com>, 30105 <at> debbugs.gnu.org
Subject: bug#30105: Additional "grep" parameter to change the exit code from 1 to 0, even if grep doesn't find pattern
Date: Sat, 13 Jan 2018 22:57:27 -0800
Vasyl Vavrychuk wrote:
> I would like to have an option to return success if nothing is found but
> still return fail if error happens.

You can use a shell command like this:

grep PATTERN FILE
test $? -lt 2

I don't see the need for a special grep option to handle this problem.




This bug report was last modified 7 years and 126 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.