In my home directory /home/regis
, after creating a symbolic link LINK
to directory DIR/SUBDIR
, and doing cd LINK
, I have a conflict between bash and its auto-completer regarding what ..
leads to.
For bash auto-completer, ..
leads to /home/regis
, as the user expects since pwd displays /home/regis/LINK
, just like the prompt does with PS1 using \w
.
For bash itself, ..
leads to DIR
and ../..
leads to /home/regis
, which means it's using the real path /home/regis/DIR/SUBDIR
, as displayed by pwd -P
.
Which behaviour should be expected here? Am I doing something wrong here?
/home/regis$ touch FILE /home/regis$ mkdir -p DIR/SUBDIR /home/regis$ ln -s DIR/SUBDIR LINK /home/regis$ cd LINK /home/regis/LINK$ ls ../FI # autocomplete with TAB succeeds here /home/regis/LINK$ ls ../FILE # but autocompleted command will fail here ls: cannot access '../FILE': No such file or directory /home/regis/LINK$ ls ../../FILE # command succeeds FILE $ bash -version GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)