On 2025-06-24 22:28, Thomas Güttler Mailinglisten wrote:
During the last months I wrote
a lot of Bash code, and often I needed to handle the non-zero exit code of
grep.
It would be handy to have an option to make grep always return zero (except
"file not found" or similar errors).
I dunno, there are several commands like grep that return exit status
1/2 for different kinds of "failure". ("diff", for example.) I doubt
whether we want to add such an option to all these commands.
"grep GREPARGS || test $? = 1" is short and easy to remember and has
worked everywhere for decades. If you dislike its syntax you can package
it inside a shell function.