Hello everybody,

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".

Why?

In bash programming I often use the "trap" command with the "ERR"
parameter. "ERR" reacts when a normal command like "grep", "mount", etc.
produces an non-zero exit code. "ERR" is similar to the bash "set -e" or
"set -o errexit" option.

My thought is, that NOT finding a pattern, is not always a reason to
consider the result as an error or the command being unsuccessfully. In
my opinion, it would just be a handy way to avoid using "awk" or "sed",
which produce exit code 0, when NOT finding a pattern. 

Just an idea... :)

Kind regards,

Robert S.







Reply via email to