📝 Added error.sh documenting how error func works
This commit is contained in:
parent
6beb8a200f
commit
478a4414ad
1 changed files with 9 additions and 0 deletions
9
scripts/error.sh
Executable file
9
scripts/error.sh
Executable 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 "$@"
|
||||
Loading…
Add table
Add a link
Reference in a new issue