]> git.corax.cc Git - toolbox/commitdiff
include/log: Use $0 to determine the script name
authorMatthias Kruk <m@m10k.eu>
Tue, 6 Apr 2021 23:39:47 +0000 (08:39 +0900)
committerMatthias Kruk <m@m10k.eu>
Tue, 6 Apr 2021 23:39:47 +0000 (08:39 +0900)
BASH_ARGV0 is not supported on older bash versions. This commit changes
the log module to use $0 to determine the script name instead.

include/log.sh

index 41d2c1c4771ce901811090e2a15514ad8eb0b871..dbac5ea7a2ab78c17f15ebfb4ec14d3200843293 100644 (file)
@@ -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