Test with non-zero status does not exit shell

Hi there,

I'm very used to use

set -e

to break my scripts if any command exits with a non-zero status.

As a policy, I'm willingly expecting

echo hello | grep a

to break the script.

The commands

test 1 -eq $1 && echo hello

exits with a non-zero status if $1 is not 1. BUT... It doesn't break the script.

Does anyone know why?

Cheers
Santiago

My man page tells me this:

1 Like

Much clearer.
The output of help set did not give me that much information.
Thanks for your help.