# basic functions
debug() { #change to false to disable debugging
if [ "$DBG_ENABLED" = true -a -n "$*" ]; then
- echo -E "$@" >>"$DBG_FILE"
+ printf '%s\n' "$*" >>"$DBG_FILE"
elif [ "$DBG_ENABLED" = true -a -z "$*" ]; then
tee -a "$DBG_FILE"
elif [ -z "$*" ]; then
}
die() {
- debug "$@"
- echo -E "$@" >>/dev/stderr
+ debug FATAL: "$*"
+ printf '%s\n' "$*" >&2
exit 1
}