Blame | Last modification | View Log | RSS feed
#!/bin/bash# Copyright (c) 2006, Ira W. Snyder (devel@irasnyder.com)# License:# Do not allow usage of unset variablesset -o nounset# Do not allow errors to keep going, exit immediately# Disable with: set +e# Re-enable with: set -eset -o errexitTEMP_FILE="$(mktemp)"function clean_up {# Perform anything that needs to be done when we exit,# whether or not the exit was a clean one.# NOTE: the first parameter will be the exit status.rm "${TEMP_FILE}"exit $1}function usage {# Display usage informationecho "Usage: $(basename "$0")" 1>&2}# Call clean_up() on interrupttrap clean_up SIGHUP SIGINT SIGTERMif [ "$#" -lt "1" ]; thenusageclean_up 1fi