On 11/30/11 2:08 AM, Clark J. Wang wrote: > (Tested with bash 4.2.10 and 4.1.9) > > [bash-4.2.10] # cat foo.compspec > compspec_foo() > { > local cmd=$1 cur=$2 pre=$3 > > if [[ $cur = :* ]]; then > COMPREPLY=( changed changed/IGNORE_ME ) > fi > } > > complete -F compspec_foo foo > [bash-4.2.10] # source foo.compspec > [bash-4.2.10] # foo :short<TAB> > [bash-4.2.10] # foo changed <-- Fine, this is what I want > [bash-4.2.10] # foo :this-is-a-long-word<TAB> > [bash-4.2.10] # foo :this-i <-- Bug here? >
First of all, you must have removed `:' from $COMP_WORDBREAKS, because you won't get any matches unless you have. I can't reproduce this behavior using bash-4.2.20 (after modifying COMP_WORDBREAKS); I get `changed' as the completion in both cases. Have you done `set -x' to get an idea of what's happening when the completion function runs? Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/