From ed7eace72b34c361eb294a3aad3e1777d52992d3 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Thu, 11 Aug 2022 20:18:02 +0900 Subject: [PATCH] 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. --- include/opt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" -- 2.47.3