Question

under Debians BASH I can do the following:

foo=/path/to/some/file

cat $f[TAB]

As you can see, I can autocomplete the variable $foo by pressing TAB.

Under Ubuntu (11) the behaviour is not the same (I've activated '/etc/bash_completion' in my bashrc).

This is working:

echo $f[TAB]

This one is not working:

cat $f[TAB]

Can anyone give me a hint, how to get the last one working?

Was it helpful?

Solution

You can remove the completion specification provided for cat by /etc/bash_completion by doing:

complete -r cat

or you can see if modifying the completion options provided in /etc/bash_completion work in the version of Bash you're using:

complete -F _longopt -o filenames -o bashdefault cat

If you're using the latest patched version of Bash 4.2, there is an option that may help (I haven't tried it):

shopt -s direxpand
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top