If the current word on the command line contains a shell variable, then the expansion works as if the variable had been expanded, but then quotes the variable. An example is probably a lot better than theory: Steps to reproduce 1. Type "echo $HOME/.bas" 2. Press tab 3. Press tab again Actual results: 2. expands to "echo \$HOME/.bash", assuming that all files ~/.bas* share the h as the fifth letter of their filename, and that at least two files differ in their sixth letter. 3. no list of possible completions, as \$HOME no longer is a variable reference, and there is no directory of that name suitable for expansion. Expected results: 2. "echo $HOME/.bash" 3. List of file names printed to choose from Past versions of bash up to 4.1 used to expand the variable when completing. In those cases, the completed version would look like "echo /home/user/.bash". A plain 4.2 build does exhibit the new behaviour as well. So it's an issue introduced in that code base. Unfortunately I know no source repository for bash where I could bisect this down to a small commit.
Forwarded this report upstream: http://thread.gmane.org/gmane.comp.shells.bash.bugs/17020
this has been reported many times upstream already. please search the archive. the behavior you describe is at odds with another, so it's kind of a crap shoot.