On my Debian servers I'm used to hitting Tab to "preview" the expansion of shell patterns:
$ cp *some*<Tab>
something somewhat have-some-cake
$ cp *some*_
When the pattern expands to one entry, Tab replaces the pattern with the actual entry; otherwise it shows a list of matching entries. This is intuitive and useful because it's consistent with the regular "prefix" Tab completion.
But my Ubuntu servers and desktops behave differently: even when it would expand to more than one entry, Tab replaces the pattern with the first entry.
I have checked the usual suspects (/etc/bash.bashrc, /etc/inputrc, and the local versions) and I couldn't find any difference.
Does anybody know which setting controls this behaviour?
Best Answer
Contrary the other answer, this particular problem is probably a direct result of using bash-completion. The bash-completion package has several bugs (as noted in this U&L answer about a similar problem, for instance).
If I comment out this section in my
.bashrc
:and start a new instance of bash, then I get:
And then if I source the
/usr/share/bash-completion/bash_completion
script like it was in the.bashrc
:The
*o*
was immediately autocompleted tofoo
without showing the other matches.I'm using 16.04, by the way. I don't know if this has been fixed in newer releases.