Bash cannot expand backticks interactively

This is a feature not a bug.

Think about the scenario this way: In order to make that completion the shell would have to RUN the command in the backticks. This could cause very serious negative consequences if it was something that wasn't meant to run more than once, that took lots of time to execute, etc.

In order to do expansion, bash needs just a string that is a path, not some program to have to execute in order to get a string to complete. Consider the suggestion to use ./ as path for the present working directory as well advised!

Backticks are not old or deprecated, although the newer $() syntax is generally preferred these days. However in your example, using a command at all is ill-advised. Backticks and command should be used sparingly and only when another syntax isn't possible.


Try

cd ./TAB

instead.

cd $VAR/...
cd $(cmd)/...

don't work for me, either. Maybe you can compare the /etc/bash_completion files.


There are situations where "$PWD/" is needed instead of "./", so it should not be suggested to always to use "./" instead of "$PWD/". One example is when you do a symbolic link.

Suppose you're in /somefolder. Now you run the following command:

ln -s ./file /target/file

This becomes a broken link. What you really need to do is:

ln -s $PWD/file /target/file

It is very inefficient to type the whole path. This problem is independent from "deprecation" issues as symlink just doesn't work in this way. Thus, I suggest you to file a bug to fix this problem.