bash

bash strict mode

unofficial bash strict mode

(I generally don’t set the IFS as recomended)

set -e #exit immediately if a simple command exits with a non-zero status
set -u #treat unset variables as an error when performing parameter expansion
set -o pipefail #exit status of last non-zero exit code is returned

create temp file

tempfile="$(/bin/mktemp)"

script name

strips of everything before the last “/”

scriptname="${0##*/}"

hostname

#find our current host
fqdn="$(/bin/hostname)"
#strip off everything after the first "."
host="${fqdn%%.*}"

date time

datetime="$(/bin/date "+%Y%m%dT%H%M%S")"