From 4579c8411ef7dae1ac871555a19f1bfbfae5b54c Mon Sep 17 00:00:00 2001 From: Wynn Wolf Arbor Date: Mon, 11 May 2020 15:44:10 +0200 Subject: Only shift positional parameters if there are any bash 5.0 now enables its 'shift_verbose' option in POSIX mode by default, printing an error message if there's not enough positional arguments for the `shift` builtin. We rely on the previous (silent) behaviour in two places. For main command parsing, introduce an explicit check before invoking `shift` to make sure it is only called if there are enough positional arguments. The call to `shift` in the list() method is actually superfluous, as no more than one positional argument is ever referenced; we drop it fully there. --- bosun | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bosun b/bosun index 7d8efeb..b462b6b 100755 --- a/bosun +++ b/bosun @@ -35,7 +35,6 @@ rebuild() { list() { subcmd="$1" - shift case $subcmd in active) list_active;; all) list_all;; @@ -66,7 +65,7 @@ list_available() { } cmd="$1" -shift +test $# -gt 0 && shift case $cmd in add) add "$@";; flush) flush;; -- cgit v1.2.3-2-gb3c3