################################################################################ # Function: usage_exit # Description: Prints the usage message for this script and then exits # Arguments: $1 :- Exit code; defaults to 1 # Outputs: Prints description of how to call this script function usage_exit { local exit_code=1 if [[ ${1-} =~ ^[0-9]+$ ]]; then exit_code="$1" fi cat << EOT Usage: $(basename "$0") [options]... -u|--user (Required) The owner of the generated file -d|--destdir (Required) The dir into which to save the new file -r|--remove Causes previous files to be removed -v|--verbose Displays verbose output -h|--help Displays this message and aborts the script NOTE: The and arguments are mandatory and *must* be supplied EOT exit "${exit_code}" }