I can't figure out what I am doing wrong. I have my bash_completion file setup as such:
_bcd()
{
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "$(back_directory.pl --complete $cur)" -- $cur) )
}
complete -o filenames -o nospace -F _bcd bcd
back_directory.pl is a program that will return directories paths up the tree: back_directory.pl --complete Th
produces: This\ test/
But:
22:50:24-Josh@Joshuas-MacBook-Air:~/Desktop/bcd/This test/more white/t$ bcd Th<TAB><TAB>
This test/
As shown above, it doesn't auto complete for directories with whitespace in them (but it shows the completion option).
It should look like this: bcd This\ test/
I thought -o filenames
should add the backslashes to escape the whitespace. Thanks for any help :)