Cause bash to behave in a way that makes many classes of subtle bugs impossible. You'll spend much less time debugging, and also avoid having unexpected complications in production.

#!/usr/bin/env bash

#
# Set unofficial Bash Strict Mode
# see: http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
IFS=$'\n\t'

#
# set -e
#
#   option instructs bash to immediately exit if any command [1] has a non-zero
#   exit status.
#
# set -u
#
#   affects variables. When set, a reference to any variable you haven't
#   previously defined - with the exceptions of $* and $@ - is an error, and
#   causes the program to immediately exit.
#
# set -o pipefail
#
#   This setting prevents errors in a pipeline from being masked. If any command
#   in a pipeline fails, that return code will be used as the return code of the
#   whole pipeline.
#