From: Matthias Kruk Date: Tue, 6 Apr 2021 23:39:47 +0000 (+0900) Subject: include/log: Use $0 to determine the script name X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=93f9dbabf93de68c0426aaaf118a3604b881f690;p=toolbox include/log: Use $0 to determine the script name BASH_ARGV0 is not supported on older bash versions. This commit changes the log module to use $0 to determine the script name instead. --- diff --git a/include/log.sh b/include/log.sh index 41d2c1c..dbac5ea 100644 --- a/include/log.sh +++ b/include/log.sh @@ -4,7 +4,9 @@ __init() { local script_name local timestamp - if ! script_name=$(basename "$BASH_ARGV0"); then + script_name="${0##*/}" + + if [[ -z "$script_name" ]]; then echo "Could not determine script name" 1>&2 return 1 fi