[Bash-completion-devel] scp remote path completion broken?

Freddy Vulto fvulto at gmail.com
Wed Sep 16 21:34:51 UTC 2009


I'm looking further into _get_cword, but COMP_CWORDS appears to behave
differently depending on the bash-version.  Can other people confirm
this?  Try this script:

---8<------------------------------------------
_cword() {
    echo
    echo COMP_CWORD: $COMP_CWORD
    echo COMP_CWORDS:
    for ((i=0; i < ${#COMP_WORDS[@]}; i++)); do
        echo $i: "${COMP_WORDS[$i]}"
    done
}
complete -F _cword a
---8<------------------------------------------

On bash-4 I get:

    $ a 'b c<TAB>
    COMP_CWORD: 3
    COMP_CWORDS:
    0: a
    1: '
    2: b
    3: c

Whereas on bash-3, bash-2 I get:

    $ a 'b c<TAB>
    COMP_CWORD: 1
    COMP_CWORDS:
    0: a
    1: 'b c

Is this because of bash-4 or because of some other setting?



More information about the Bash-completion-devel mailing list