From 4047123683532dc2a07166b8e6c6fdedd04b920d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Wed, 14 Sep 2022 16:38:04 +0200 Subject: [PATCH] fix basename, when -bash is shell --- logging | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/logging b/logging index f77051d..7a21e1f 100644 --- a/logging +++ b/logging @@ -14,7 +14,7 @@ for level in SCRIPTENTRY SCRIPTEXIT ENTRY EXIT; do echo "[%s] »${BASH_SOURCE[0]##*/} (${FUNCNAME[1]}) « ######################################################" >&2 fi if [[ ! ${loglevels[*]} =~ "${FILELOGLEVEL:-$FILELOGLEVEL_DEFAULT}" ]];then - echo "[${timeAndDate}] [%s] $(basename $0) (${FUNCNAME[1]})" >> "${SCRIPT_LOG}" + echo "[${timeAndDate}] [%s] $(basename -- $0) (${FUNCNAME[1]})" >> "${SCRIPT_LOG}" fi }' "${level}" "${level^^}" "${level^^}" eval "$functext" export -f "${level}" @@ -33,7 +33,7 @@ for level in ${loglevels[@]}; do printf "[%%s] (%%s) %%s\n" %s "${FUNCNAME[1]}" "${msg}" >&2 fi if [[ ! ${loglevels[*]} =~ "${FILELOGLEVEL:-$FILELOGLEVEL_DEFAULT}" ]];then - printf "[%%s] [%%s] %%s (%%s) %%s\n" "$timeAndDate" %s "$(basename $0)" "${FUNCNAME[1]}" "${msg}" >> "${SCRIPT_LOG}" + printf "[%%s] [%%s] %%s (%%s) %%s\n" "$timeAndDate" %s "$(basename -- $0)" "${FUNCNAME[1]}" "${msg}" >> "${SCRIPT_LOG}" fi }' "$level" "$(echo ${loglevels[@]})" "${level^^}" "${level^^}" eval "$functext" export -f "log${level}"