How to configure bash to always resolve full path for symlinks
There is a shell-wide option for this:
-P
If set, do not resolve symbolic links when performing commands such as
cd
which change the current directory. The physical directory is used instead. By default, Bash follows the logical chain of directories when performing commands which change the current directory.For example, if /usr/sys is a symbolic link to /usr/local/sys then:
$ cd /usr/sys; echo $PWD /usr/sys $ cd ..; pwd /usr
If
set -P
is on, then:$ cd /usr/sys; echo $PWD /usr/local/sys $ cd ..; pwd /usr/local
So this should get you the behaviour you want:
set -P