bash tab completion with spaces
I'm having a problem with bash-completion when the possible options may contain spaces. Let's say I want a function which echoes the first argument: function test1() { echo $1 } I generate a list of possible completion options (some have spaces, some not), but I don't manage to handle spaces correctly. function pink() { # my real-world example generates a similar string using awk and other commands echo "nick\ mason syd-barrett david_gilmour roger\ waters richard\ wright" } function _test() { cur=${COMP_WORDS[COMP_CWORD]} use=`pink` COMPREPLY=( $( compgen -W "$use" -- $cur ) ) } complete -o