[Bash-completion-devel] Get stuck again

Igor Murzov e-mail at date.by
Sun Nov 13 22:05:20 UTC 2011


I can't understand how $COMP_WORDBREAKS works and why quotes on command line give such a weird result. Test function is following:
--------------------------
_zz()
{
    echo -e "\n* $COMP_CWORD:"
    for (( i=0; i <= COMP_CWORD; i++ )); do
        echo "[${COMP_WORDS[i]}]"
    done
} && complete -F _zz zz
--------------------------

That's what the function prints if there are quotes on command line:
--------------------------
$ zz --w="v u" --x=abc --y=0,a2 xx<TAB>
* 4:
[zz]
[--w]
[="]
[v]
[u" --x=abc --y=0,a2 xx]
--------------------------

Without quotes result looks fine:
--------------------------
$ zz --w=v\ u --x=abc --y=0,a2 xx<TAB>
* 10:
[zz]
[--w]
[=]
[v\ u]
[--x]
[=]
[abc]
[--y]
[=]
[0,a2]
[xx]
--------------------------

Am I missing something or is it a bug in bash?


-- Igor



More information about the Bash-completion-devel mailing list