When I need to suppress some kind of output e.g.

foo | grep -v bar

But foo gives sometimes only:

bar
bar
bar...

grep will return -1. How do I transform the exit code 1 to 0?

link|improve this question

feedback

1 Answer

up vote 1 down vote accepted

You could always try piping it through something else, like cat, to get rid of the exit code from grep - though that may be a bigger hammer than you want.

link|improve this answer
and this seems even to be Posix compliant – math Jul 20 '10 at 16:10
2  
You can also do || true if you're trying to bypass failure under set -e – Daenyth Jul 20 '10 at 16:57
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.