mirror of
https://github.com/octoleo/hosts.git
synced 2025-01-01 13:41:50 +00:00
Use unset
rather than slicing for bash 3.2 compatibility.
Use `unset` to remove the first element of `$_COMMAND_PARAMETERS` rather than slicing because under bash 3.2 the resulting slice is treated as a quoted string and doesn't easily get coaxed back into an array.
This commit is contained in:
parent
6733260385
commit
b539cd6136
9
hosts
9
hosts
@ -255,7 +255,13 @@ done
|
||||
# Set $_COMMAND_PARAMETERS to $_COMMAND_ARGV, minus the initial element, $0. This
|
||||
# provides an array that is equivalent to $* and $@ within each command
|
||||
# function, though the array is zero-indexed, which could lead to confusion.
|
||||
_COMMAND_PARAMETERS=("${_COMMAND_ARGV[@]:1}")
|
||||
#
|
||||
# Use `unset` to remove the first element rather than slicing (e.g., not
|
||||
# `_COMMAND_PARAMETERS=("${_COMMAND_ARGV[@]:1})`) because under bash 3.2 the
|
||||
# resulting slice is treated as a quoted string and doesn't easily get coaxed
|
||||
# into a new array.
|
||||
_COMMAND_PARAMETERS=(${_COMMAND_ARGV[*]})
|
||||
unset _COMMAND_PARAMETERS[0]
|
||||
|
||||
_debug printf "\$_CMD: %s\n" "$_CMD"
|
||||
_debug printf "\$_RAW_OPTIONS (one per line):\n%s\n" "$_RAW_OPTIONS"
|
||||
@ -1070,4 +1076,3 @@ show() {
|
||||
|
||||
# Calling the _main function after everything has been defined.
|
||||
_main
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user