To make a bash script exit after any failed command, you can add
set -e
Imagine, you have a CI agent which allow people to embed bash scripts as tasks in build jobs.
How to make the exit behaviour given by set -e
default for all new bash instances? Is there some sort of bashrc
hack for that?
SHELLOPTS=errexit
in the environment would do it, but in my opinion and that of manyset -e
is almost never the right way to do error handling. – Stéphane Chazelas Feb 01 '18 at 19:56