diff --git a/tools/bash-completion/vsh b/tools/bash-completion/vsh index bbb25fc3eb..402945a8c5 100644 --- a/tools/bash-completion/vsh +++ b/tools/bash-completion/vsh @@ -30,12 +30,12 @@ _vsh_complete() c=$((++c)) done - CMDLINE= + CMDLINE=( ) if [ -n "${RO}" ]; then - CMDLINE="${CMDLINE} -r" + CMDLINE+=("-r") fi if [ -n "${URI}" ]; then - CMDLINE="${CMDLINE} -c ${URI}" + CMDLINE+=("-c" "${URI}") fi INPUT=( "${COMP_WORDS[@]:$i:$COMP_CWORD}" ) @@ -56,7 +56,7 @@ _vsh_complete() # the name of the command whose arguments are being # completed. # Therefore, we might just run $1. - IFS=$'\n' A=($($1 ${CMDLINE} complete -- "${INPUT[@]}" 2>/dev/null)) + IFS=$'\n' A=($($1 ${CMDLINE[@]} complete -- "${INPUT[@]}" 2>/dev/null)) COMPREPLY=($(compgen -W "${A[*]%--}" -- ${cur})) __ltrim_colon_completions "$cur"