bug-grep
[Top][All Lists]
Advanced

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

bug#30105: Additional "grep" parameter to change the exit code from 1 to


From: Vasyl Vavrychuk
Subject: bug#30105: Additional "grep" parameter to change the exit code from 1 to 0, even if grep doesn't find pattern
Date: Sun, 14 Jan 2018 18:32:42 +0200

Actually I use grep in pipe with

  set -eo pipefail

but still there I can do

  ... | grep exrp || test $? -lt 2 | ...

Thanks for suggestion.

On Sun, Jan 14, 2018 at 8:57 AM, Paul Eggert <address@hidden> wrote:
> 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.





reply via email to

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