To access files in a directory from another directory, I often set a variable for that directory. For example (so you can try it your self),
export dir1=/usr/local/bin
and then type ls $dir1/
followed by tab
. I wanted the shell to show the files under /usr/local/bin but by the tab
, the character $
is escaped with \
to become \$dir1
and the shell doesn't understand it as $dir1
anymore and doesn't expand it to /usr/local/bin not showing the files there. This is quite annoying (I used to do these things with no problem before but is it happening from ubuntu-22.04?). Is there any way I can stop this auto escaping during the file name auto completion?
p.s. - I saw https://lists.gnu.org/archive/html/bug-bash/2011-02/msg00280.html but found no answer, just non essential long discussions that are not to the point..
This behavior is controlled by the
direxpand
shell option:So check if the option is set in your shell (
shopt direxpand
) and if not, set it withshopt -s direxpand
.See