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,7 +3,10 @@
source ./log_helpers
exec_process_substitution () {
if [ "${general_utils_sourced:-1}" = "1" ]; then # include only once
readonly general_utils_sourced=${BASH_SOURCE[0]}
exec_process_substitution () {
local func="${FUNCNAME[0]}"
log_debug "$func:${LINENO} exec-ing [$*]"
@ -27,23 +30,34 @@ exec_process_substitution () {
log_debug "$func:${LINENO} result=$__result"
printf '%s' "$__result"
return $__result_code
}
}
usage () {
usage () {
echo "Usage: $PROGRAM [--file config] [--?] [--help] [--version] [--dbg]"
# UpdateController.conf"
}
}
usage_and_exit () {
usage_and_exit () {
usage
exit $1
}
}
version () {
version () {
echo "$PROGRAM version $VERSION"
}
}
error () {
error () {
echo "$@" 1>&2
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