emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#30105: closed (Additional "grep" parameter to chan


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#30105: closed (Additional "grep" parameter to change the exit code from 1 to 0, even if grep doesn't find pattern)
Date: Sun, 14 Jan 2018 17:17:01 +0000

Your message dated Sun, 14 Jan 2018 09:16:41 -0800
with message-id <address@hidden>
and subject line Re: bug#30105: Additional "grep" parameter to change the exit 
code from 1 to 0, even if grep doesn't find pattern
has caused the debbugs.gnu.org bug report #30105,
regarding Additional "grep" parameter to change the exit code from 1 to 0,  
even if grep doesn't find pattern
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
30105: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=30105
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Re: Additional "grep" parameter to change the exit code from 1 to 0, even if grep doesn't find pattern Date: Sun, 14 Jan 2018 07:21:11 +0200
> > I want to suggest my idea about a additional "grep" parameter which
> > would change the exit code 1 to 0, even when "grep" doesn't find a
> > pattern. I.e. something similar to "-0".
>
> Thanks, but you can avoid triggering your trap
> by appending "|| :" to your grep command.
>
> E.g.,
>
>     grep not-found /dev/null || :
>
> Then, even when grep fails, the shell sees only the successful
> exit code from the ":" (always succeeding) built-in command.

It replaces exit status 2 with success too.
I would like to have an option to return success if nothing is found but
still return fail if error happens.



--- End Message ---
--- Begin Message --- Subject: Re: 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 09:16:41 -0800 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0
Vasyl Vavrychuk wrote:
Actually I use grep in pipe with

   set -eo pipefail

but still there I can do

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

Thanks for suggestion.

You're welcome. You'll need to parenthesize of course. Closing the bug.


--- End Message ---

reply via email to

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