Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In 10.04 Terminal I can enter the command: cat $MYDIR/a then hit tab and auto-completion expands it to: cat /home/me/abc.txt

(I have defined MYDIR in my .bashrc)

In 12.04 it auto completes to: cat \$MYDIR/abc.txt and gives a no such file error

How can I get the 10.04 behaviour in this respect?

share|improve this question

This one is complex. It is not really a bug, but an unintended consequence of a feature: see this discussion.

But yes, that is the behavior of bash 4.2, and many people have complained that it is a bug. The solution is to either downgrade the bash to the 4.1 version, or upgrade it to 4.2.29, where this bug has been ironed out.

A temporary solution is described here

shopt -s cdable_vars
complete -v -F _cd $nospace $filenames cd
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.