symbolic link question

Bob Bell bobbell at zk3.dec.com
Tue Dec 3 15:45:05 EST 2002


On Tue, Dec 03, 2002 at 02:46:17PM -0500, Price, Erik <eprice at ptc.com> wrote:
> I have created a symbolic link in my home directory that points to
> another directory on the server.  This is a nice shortcut to that
> other directory.  However, when I cd into the other directory through
> my symbolic link, then echo the current working directory with either
> "pwd" or "echo $PWD", the pathname takes into account the fact that
> I accessed it from a symbolic link.
> 
> I'm not disputing this, but rather I'm curious of what's keeping track
> of this -- my shell session (bash)?  I would have made the assumption
> that once I switched to the other directory, I am now for all intents
> and purposes in that other directory with no memory of the original,
> but in this I am wrong.

    Yes, this is your shell keeping track of how you got to where you
are (your 'logical path').  This is usually also reflected in the PWD
environment variable.  In bash and ksh, you can use 'pwd -P' to get your
real path.  Or, you can run /bin/pwd instead of the shell builtin.  This
is also reflected with getcwd().

P.S. Please set your mail to wrap long lines.

-- 
Bob Bell <bobbell at zk3.dec.com>
-------------------------------------------------------------------------
 "We all know Linux is great...it does infinite loops in 5 seconds."
   -- Linus Torvalds, creator of the Linux operating system



More information about the gnhlug-discuss mailing list