(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
tempfile="$(/bin/mktemp)"
strips of everything before the last “/”
scriptname="${0##*/}"
#find our current host
fqdn="$(/bin/hostname)"
#strip off everything after the first "."
host="${fqdn%%.*}"
datetime="$(/bin/date "+%Y%m%dT%H%M%S")"
Useful for checking a number was passed from the cli
re='^[0-9]+$'
if ! [[ ${1} =~ $re ]] ; then
echo "error: $0 NUMBER" >&2; exit 1
fi