bash: “set -e” and “set -x”

set -e

-e Exit immediately if a command exits with a non-zero status.

set -x

-x Print commands and their arguments as they are executed.


bash-3.2$ help set



Note, there’s an argument (in the SO post) that better practice is:

trap 'do_something' ERR


Leave a Reply

Your email address will not be published. Required fields are marked *