On Wed, Dec 7, 2011 at 9:43 PM, Miles Bader <mi...@gnu.org> wrote: > I notice that recently the behavior of bash completion w/r/t > environment variables has changed, in a reallllly annoying way: > > If one has an environment variable like: > > ls=/usr/local/src > > and then hit <TAB> to complete the following command line: > > $ cd $ls/ema<TAB> > > where the intent is to do "cd /usr/local/src/emacs", then: > > * The _old_ behavior of bash was to (1) expand "$ls" to > "/usr/local/src", and then (2) proceed to complete > "/usr/local/src/ema" into "/usr/local/src/emacs". Handy! > > * The _new_ behavior is to just add a backslash before "$" and then > (apparently) try to complete on the literal-$-prefixed string -- > which of course usually fails, as there is no such subdirectory. > Gahhhh! > > Given that filenames/directories containing a literal "$" are quite > rare in general, and the old behavior enabled a _very_ useful way of > using environment variables as "bookmarks", I think this change should > be reverted (obviously compatibility is not a concern, as this change > was itself an incompatible change). > > My bash version is "4.2.20(1)-release (x86_64-pc-linux-gnu)" in Debian > sid. If this isn't actually a bash problem then apologies... (dunno > what it would be then, though)! > > Thanks, > > -Miles > > -- > Friendless, adj. Having no favors to bestow. Destitute of fortune. Addicted to > utterance of truth and common sense. > >
There have been a number of threads discussing this issue. http://groups.google.com/group/gnu.bash.bug/browse_thread/thread/9196eeea7a268a3f/0968f408d82d65f9?lnk=gst&q=tab+variable+expansion#0968f408d82d65f9 This discussion includes a patch and ways to fix the issue.