fix basename, when -bash is shell

This commit is contained in:
Jakobus Schürz 2022-09-14 16:38:04 +02:00
parent 8cd1000cd5
commit 4047123683

View file

@ -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}"