Good lines to put at the top of every bash file:
# Treat uninitialized vars as a reason to exit, rather than as null set -u # Exit on the first non-zero return code set -e # Exit on the first non-zero return code of any program in a pipeline set -o pipefail