Bash - Template
Updated at 2017-06-17 04:11
#!/bin/bash
set -xeuo pipefail
# -x = Shell will log to each command to standard error before it is executed.
# -e = Shell will exit immediately if any of the commands return status >0,
# except if it's part of while, until, if, AND, OR, !.
# -u = Accessing unset variables exits the shell.
# -o pipefail = Failure of any commands in pipelines exits the shell.
Command-to-variable assignment can cause problems. If you set output of a command to a variable and it returns non-zero status code, -e
will cause the script to fail.