Thomas Güttler Mailinglisten <[email protected]> writes:
> To make Bash more robust, I use the "strict mode".
>
> This works fine, except that very often I want to filter out some
> output, and it does not matter to me if there is a match or not.
>
> Afaik there is no option to make `grep` always exit with a zero exit
> status. No matter if a match was found or not. Errors like "file not found"
> should still return a non-zero exit status.
Well, this isn't what you asked for, but it's a reasonaby terse way to
get the effect without modifying grep:
grep ... || [[ $? != 2 ]]
That has an exit status of 1 if grep exits with 2, and an exit status of
0 otherwise.
Dale