.bash_profile I set short variables to ease the access to some common directories. For example:
So I use it like this for example:
$ cd $lh $ less $lh/access_log
But when I want to use the Tab key in order autocomplete filenames (in such a parameter containing a variable reference), bash performs the autocomplete but
also inserts a backslash
\ before the dollar sign of the variable name.
For example, typing
then hitting Tab will expand to:
Of course, what I would like instead is
(weirdly, with the
cd command the autocomplete doesn't work at all in that case, this question already talks about it)
I know that there is an alternative by using
shell-expand-line (default key: Ctrl+Alt+E), but it's far from
perfect because it expands aliases as well, and it doesn't quote paths with special chars (spaces, ...).
Is there a way in bash to expand filenames with Tab, even when a shell variable is used in the path?