# trap_error() {
#   printf '%b\n' "\nERROR line ${1}: Command exited with status ${?}"
# }
# trap 'trap_error ${LINENO}' EXIT INT

trap 'echo >&2 "Error - exited with status $? at line $LINENO:";
         pr -tn $0 | tail -n+$((LINENO - 3)) | head -n7 >&2' EXIT INT
trap - HUP # reset the ERR trap
