source general_utils only once
This commit is contained in:
parent
7d9fc7cb23
commit
2454b86e5e
@ -3,7 +3,10 @@
|
|||||||
|
|
||||||
source ./log_helpers
|
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]}"
|
local func="${FUNCNAME[0]}"
|
||||||
log_debug "$func:${LINENO} exec-ing [$*]"
|
log_debug "$func:${LINENO} exec-ing [$*]"
|
||||||
|
|
||||||
@ -27,23 +30,34 @@ exec_process_substitution () {
|
|||||||
log_debug "$func:${LINENO} result=$__result"
|
log_debug "$func:${LINENO} result=$__result"
|
||||||
printf '%s' "$__result"
|
printf '%s' "$__result"
|
||||||
return $__result_code
|
return $__result_code
|
||||||
}
|
}
|
||||||
|
|
||||||
usage () {
|
usage () {
|
||||||
echo "Usage: $PROGRAM [--file config] [--?] [--help] [--version] [--dbg]"
|
echo "Usage: $PROGRAM [--file config] [--?] [--help] [--version] [--dbg]"
|
||||||
# UpdateController.conf"
|
# UpdateController.conf"
|
||||||
}
|
}
|
||||||
|
|
||||||
usage_and_exit () {
|
usage_and_exit () {
|
||||||
usage
|
usage
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
version () {
|
version () {
|
||||||
echo "$PROGRAM version $VERSION"
|
echo "$PROGRAM version $VERSION"
|
||||||
}
|
}
|
||||||
|
|
||||||
error () {
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user