diff options
author | Wynn Wolf Arbor | 2020-05-11 15:44:10 +0200 |
---|---|---|
committer | Wynn Wolf Arbor | 2020-05-13 14:31:08 +0200 |
commit | 4579c8411ef7dae1ac871555a19f1bfbfae5b54c (patch) | |
tree | b33bf3597edd1f72b127f1714f7d9d3285154190 | |
parent | ec83ba371971dd2e00f46a17c7e22715756e18a1 (diff) | |
download | bosun-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.
-rwxr-xr-x | bosun | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -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;; |