From: Phil Farrell <farrell@pangea.stanford.edu>
To: m248262@decux1.mdc.com
Subject: Re: Q? Resolve true pwd, not sym-link
Date: 1996/10/25 [thread overview]
Message-ID: <3270E96F.43B0@pangea.stanford.edu> (raw)
In-Reply-To: 54pg5t$4qs@newsbf02.news.aol.com
HARDINGDGH wrote:
>
> Hi,
>
> I am trying to force unix (ksh or csh) to give my the 'true' name of a
> directory, not the symbolic link name of a directory.
> ...[much elided]
> I have done some coding in fortran where I will write a script file like
> this:
>
> #!/bin/csh
> cd <file_spec_possibly_containing_symbolics>
> echo $cwd > /home/m248262/targetdir.out
>
> Then I have a fortran subroutine which will launch this script, and
> another subroutine which will read the targetdir.out file. But I have
> found that in some cases that the 'echo $cwd' will return the symbolic
> name of a subdirectory rather than the 'true' directory name.
"cwd" is an internal shell variable. It is quite possible that the shell is lazy
and just puts the symbolic link that you specified in there, rather than the
full name to which it expands.
Why not replace the "echo $cwd" line with "pwd"? This will run
the pwd program to determine your current real directory. Pwd is external to
the shell, so it doesn't know anything about any symbolic link name you may
have used to get to the current directory. It just uses system calls to
determine the current directory.
--
Phil Farrell, Computer Systems Manager
Stanford University School of Earth Sciences
farrell@pangea.stanford.edu
prev parent reply other threads:[~1996-10-25 4:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-10-25 4:00 Q? Resolve true pwd, not sym-link HARDINGDGH
1996-10-25 4:00 ` Phil Farrell [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox