#[BASH] SET -debug | error
#
Catch all errors in your script:
## debug
set -e -u -o pipefail
IFS=$'\n\t'
on_error() { echo "Error on or near line $1; exiting with status $2"; exit "$2"; }
# Trap error exit possible
#trap 'on_error ${LINENO} $?' ERR
# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi