Paul Griffith wrote:
On Thu, 2009-11-05 at 18:09 +0100, Joerg Schilling wrote:
Paul Griffith <[email protected]> wrote:

Greetings,

I noticed a subtle difference in symbolic links between Linux and
OpenSolaris.

Look at the two examples below. It is like OpenSolaris is treating the
sym link like a hardlink. So what is the problem?  Under OS pwd returns
the link name as the current working directory if you cd into the
symlinked dir  and under Linux pwd return the target name as the current
working directory if you cd into the symlinked dir.
A simple question should answer your questions: What shell did you use with which test?

Jörg



I used tcsh on Solaris Sparc and Linux and bash on OpenSolaris. Due to
many responses I now know that different shells will give different
results with pwd and symlinked directories.

Paul,

        Just to beat the dead horse a bit further...
pwd is a built-in function of bash/sh/ksh. I don't believe that pwd is built into csh. There is also the command /usr/bin/pwd which should always return the "true" path.

pw...@nova:/tmp$ ls -ld dir*
drwxr-xr-x   2 root     root         117 Nov  5 12:59 dir1
lrwxrwxrwx   1 root     root           4 Nov  5 13:00 dir2 -> dir1
pw...@nova:/tmp$ cd dir2
pw...@nova:/tmp/dir2$ pwd
/tmp/dir2
pw...@nova:/tmp/dir2$ /bin/pwd
/tmp/dir1
pw...@nova:/tmp/dir2$ ps
  PID TTY         TIME CMD
 3291 pts/2       0:00 bash
 4930 pts/2       0:01 ps

        Take a look at the man pages for bash(1) and pwd(1) for details.

-Phil
_______________________________________________
opensolaris-discuss mailing list
[email protected]

Reply via email to