aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWynn Wolf Arbor2020-05-11 15:44:10 +0200
committerWynn Wolf Arbor2020-05-13 14:31:08 +0200
commit4579c8411ef7dae1ac871555a19f1bfbfae5b54c (patch)
treeb33bf3597edd1f72b127f1714f7d9d3285154190
parentec83ba371971dd2e00f46a17c7e22715756e18a1 (diff)
downloadbosun-4579c8411ef7dae1ac871555a19f1bfbfae5b54c.tar.gz
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.
Diffstat (limited to '')
-rwxr-xr-xbosun3
1 files changed, 1 insertions, 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;;