How do I get cd to switch to the full path when following symbolic links?
you should use cd
with -P
option to do that.
from man pange:
-P Handle the operand dot-dot physically; symbolic link components shall be resolved before dot-dot components
are processed (see step 7. in the DESCRIPTION).
small test to show how does it work:
kent@ArchT60:/tmp$ ls -ld /opt/google/picasa/
drwxr-xr-x 3 root root 4096 Aug 5 2010 /opt/google/picasa/
kent@ArchT60:/tmp$ ln -s /opt/google/picasa/ cdLink
kent@ArchT60:/tmp$ ls -l cdLink
lrwxrwxrwx 1 kent kent 19 Nov 15 21:23 cdLink -> /opt/google/picasa/
kent@ArchT60:/tmp$ cd -P cdLink
kent@ArchT60:/opt/google/picasa$ pwd
/opt/google/picasa
kent@ArchT60:/opt/google/picasa$ cd /tmp/cdLink
kent@ArchT60:/tmp/cdLink$
kent@ArchT60:/tmp/cdLink$ cd -P ..
kent@ArchT60:/opt/google$
i think the example above showed what you are looking for.