Inverting bash return value
grep
returns 0 when it gets a hit, doing ! grep
returns a 1 instead. The space is important and it works for any command.
Alternative
command && exit 1
This uses &&
to run on success but returns 1
grep
returns 0 when it gets a hit, doing ! grep
returns a 1 instead. The space is important and it works for any command.
Alternative
command && exit 1
This uses &&
to run on success but returns 1