From 478a4414ad277afa82f662f60ece6d9886a0f551 Mon Sep 17 00:00:00 2001 From: z3rOR0ne Date: Tue, 20 Dec 2022 03:47:18 -0800 Subject: [PATCH] :memo: Added error.sh documenting how error func works --- scripts/error.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 scripts/error.sh diff --git a/scripts/error.sh b/scripts/error.sh new file mode 100755 index 00000000..e6bcc087 --- /dev/null +++ b/scripts/error.sh @@ -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 "$@"