Could someone please explain this to me? I'm having trouble understanding how this is set up and why it behaves the way it does.
I wanted to see where
zsh is actually installed on a machine that I use. So I used
ls to find where the symlink points.
$ ls -l /bin/zsh lrwxrwxrwx 1 root root 14 Dec 1 2011 /bin/zsh -> ../sfw/bin/zsh*
When I saw this, I thought, "Okay, the symlink uses a relative path. No big deal."
But if I then try to
cd directly to what should be where the relative path points, I get this:
$ cd /bin/sfw/bin cd: no such file or directory: /bin/sfw/bin
However, if I specifically type this
$ cd ../sfw/bin
/bin is the working directory, then it works. And then I also get this:
$ pwd /usr/sfw/bin
What is going on here?