How can I get the shell to understand the full path after following a symbolic link. In the example below I'd like the first "pwd" command to report "/Users/sholden/Projects/PS1/examples", and the "cd .." command to take me to /Users/sholden/Projects/PS1/ rather than back to my home directory. I have a dim memory of a setting that did this in the Bourne shell (or was it Korn?*) but I'm having trouble dredging up the details from 25 years ago …
AirHead:~ sholden$ ls -ld examples
lrwxr-xr-x 1 sholden staff 53 Nov 15 09:33 examples -> /Users/sholden/Projects/PS1/examples
AirHead:~ sholden$ cd examples
AirHead:examples sholden$ pwd
/Users/sholden/examples
AirHead:examples sholden$ cd ..
AirHead:~ sholden$ pwd
/Users/sholden
AirHead:~ sholden$
Was it "set hardpaths?" Thanks in advance.
* It was neither – I was a csh
user back then.
Best Answer
you should use
cd
with-P
option to do that.from man pange:
small test to show how does it work:
i think the example above showed what you are looking for.