notes/scripts/error.sh
2022-12-20 03:47:18 -08:00

9 lines
274 B
Bash
Executable file

#!/usr/bin/env bash
error() {
printf "error: %s\n" "$1" 1>&2
# second argument is not required (defaults to 2)
# if second argument is provided, it must be a number,
# this is to assign an error code number to the exit command
${2:+exit $2}
}
error "$@"