X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=shell-completion%2Fbash%2Ftimedatectl;h=a57fbd25466ffbd5479ddf25ea98f53c5121b309;hb=b4f91f2ba354c16dc23111cc231010c975c717a2;hp=2842b3106925d81fb470f670b1cd439a748792f6;hpb=d611dadcc74db10ba533ee6859308f5fc505aee1;p=elogind.git diff --git a/shell-completion/bash/timedatectl b/shell-completion/bash/timedatectl index 2842b3106..a57fbd254 100644 --- a/shell-completion/bash/timedatectl +++ b/shell-completion/bash/timedatectl @@ -18,16 +18,17 @@ # 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 } _timedatectl() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local OPTS='-h --help --version --adjust-system-clock --no-pager - --no-ask-password -H --host' + --no-ask-password -H --host --machine' if __contains_word "$prev" $OPTS; then case $prev in @@ -51,7 +52,7 @@ _timedatectl() { [TIME]='set-time' ) - 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