From: Matthias Kruk Date: Thu, 11 Aug 2022 11:18:02 +0000 (+0900) Subject: include/opt: Print correct script name on older bash versions X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=ed7eace72b34c361eb294a3aad3e1777d52992d3;p=toolbox include/opt: Print correct script name on older bash versions 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. --- diff --git a/include/opt.sh b/include/opt.sh index 7c96c7b..7e3875b 100644 --- a/include/opt.sh +++ b/include/opt.sh @@ -122,7 +122,7 @@ opt_print_help() { shortopts+="$short" done - echo "Usage: $BASH_ARGV0 [-$shortopts]" + echo "Usage: ${0##*/} [-$shortopts]" echo "" echo "Options"