X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=shell-completion%2Fbash%2Fhostnamectl;h=9c75da9e7f8b6f699f0d465d1563e9e10e514650;hp=a57bffe15f7647525d2ac6ba04b2bd9c39d5898e;hb=becad8f1ed696433b9841cbb9c4603c303338d30;hpb=d611dadcc74db10ba533ee6859308f5fc505aee1 diff --git a/shell-completion/bash/hostnamectl b/shell-completion/bash/hostnamectl index a57bffe15..9c75da9e7 100644 --- a/shell-completion/bash/hostnamectl +++ b/shell-completion/bash/hostnamectl @@ -18,9 +18,10 @@ # along with systemd; If not, see . __contains_word () { - local word=$1; shift - for w in $*; do [[ $w = $word ]] && return 0; done - return 1 + local w word=$1; shift + for w in "$@"; do + [[ $w = "$word" ]] && return + done } _hostnamectl() { @@ -40,7 +41,7 @@ _hostnamectl() { [NAME]='set-hostname' ) - for ((i=0; i <= COMP_CWORD; i++)); do + for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then verb=${COMP_WORDS[i]} break