📝 Added error.sh documenting how error func works

This commit is contained in:
z3rOR0ne 2022-12-20 03:47:18 -08:00
parent 6beb8a200f
commit 478a4414ad

9
scripts/error.sh Executable file
View file

@ -0,0 +1,9 @@
#!/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 "$@"