Hacker News new | ask | show | jobs
by wolfgang42 3376 days ago
To expound on this:

"set -e" is short for "set -o errexit", that is, abort the script if a command returns with a non-zero exit code.

"set -u" is short for "set -o nounset", that is, abort the script if a variable name is dereferenced when the variable hasn't been set.

I also strongly suggest reading http://www.davidpashley.com/articles/writing-robust-shell-sc... for more things that you should be aware of when writing bash scripts.