]> git.corax.cc Git - toolbox/commitdiff
include/opt: Print correct script name on older bash versions
authorMatthias Kruk <m@m10k.eu>
Thu, 11 Aug 2022 11:18:02 +0000 (20:18 +0900)
committerMatthias Kruk <m@m10k.eu>
Thu, 11 Aug 2022 11:47:14 +0000 (20:47 +0900)
The opt module references $BASH_ARGV0 to get the name of the running
script. However, the variable does not exist on older bash versions,
causing a gap in the help text.

This commit modifies the opt module to access the script name from
$0, which should be available on all bash versions.

include/opt.sh

index 7c96c7bb1989c1a952f7f8508b0032f7997fa61e..7e3875b2dea0ee94fa680056839ee56a587011ba 100644 (file)
@@ -122,7 +122,7 @@ opt_print_help() {
                shortopts+="$short"
        done
 
-       echo "Usage: $BASH_ARGV0 [-$shortopts]"
+       echo "Usage: ${0##*/} [-$shortopts]"
        echo ""
        echo "Options"