Bash completion for path in argument (with equals sign present)

Viewed 3349

I used to be able to type the following:

$> ./foo --arg=<TAB>

Where foo is any program I wrote, and it would give me a list of files in the current directory, just like tab-completion normally does. I didn't have to make any changes to /etc/bash_completion.

Recently, however, this has gone away for some unknown reason. Does anyone know how to re-enable this feature?

FWIW, this still does the correct thing (notice the lack of an equals sign):

$> ./foo --arg <TAB>

3 Answers

Not sure what environment you're in, but on a recent CentOS

complete -D -o default

enables filename completion after a token w/o whitespace as the default. To toggle it in the other direction:

complete -D -o nospace

However, it looks like older versions of the builtin don't have the -D option.

Related