source general_utils only once

This commit is contained in:
Gerhard Hoffmann 2022-06-02 17:26:55 +02:00
parent 7d9fc7cb23
commit 2454b86e5e

View File

@ -3,6 +3,9 @@
source ./log_helpers source ./log_helpers
if [ "${general_utils_sourced:-1}" = "1" ]; then # include only once
readonly general_utils_sourced=${BASH_SOURCE[0]}
exec_process_substitution () { exec_process_substitution () {
local func="${FUNCNAME[0]}" local func="${FUNCNAME[0]}"
log_debug "$func:${LINENO} exec-ing [$*]" log_debug "$func:${LINENO} exec-ing [$*]"
@ -47,3 +50,14 @@ error () {
echo "$@" 1>&2 echo "$@" 1>&2
usage_and_exit 1 usage_and_exit 1
} }
alert () {
# usage: alert <$?> <object>
if [ "$1" ne 0 ]; then
echo "WARNING: $2 did not complete successfully." >&2
exit 1
else
echo "INFO: $2 completed successfully" >&2
fi
}
fi