Bash Header for all scripts

    #!/usr/bin/env bash
    readonly DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )";
    cd $DIR;
    set -e
    set -u
    set -o pipefail
    standardIFS="$IFS"
    IFS=$'\n\t'
    echo "
    ===========================================
    $(hostname) $0 $@
    ===========================================
    "

The above script makes bash prompt’s behaviour more predicatable when developing your automated scripts. It will prevent the script from continuing any further when an error is encountered meaning that there is a much lower chance of anything going completely wrong in edge cases

Another helpful feature is that the directory is normalised to the script’s working directory and stored in a variable to allow easier path referencing.