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_wor...@]}; 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?

_______________________________________________
Bash-completion-devel mailing list
Bash-completion-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/bash-completion-devel

Reply via email to