* Q? Resolve true pwd, not sym-link
@ 1996-10-25 4:00 HARDINGDGH
1996-10-25 4:00 ` Phil Farrell
0 siblings, 1 reply; 2+ messages in thread
From: HARDINGDGH @ 1996-10-25 4:00 UTC (permalink / raw)
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. Below (rather
lengthy I appologize) I give an example of what I am trying to do because
I do not trust my unix vocabulary to properly convey my needs. I am a
recent 'convert' from VAX/VMS and I am still working my way up the
learning curve.
I am working on a Dec ALPHA 8250 (#?). To hasten my movement around
the system I have symbolicly created subdirectories off my home directory
to directories that I most often work in.
ie from my home dir (/home/m248262) I have done the following:
ln -s /data/t45sdf/r100/loads t45sdf
Now say I want to access a fortran program in data/t45sdf/r100/aero
from my home directory I might say:
vi t45sdf/../aero/aopt1.f
My problem is that when I specify files to a fortran I often want to
use symbolic references to save myself keystrokes. At the same time I
want to resolve where the file really is because to document my work I
write out the name of my input and output data files to a log file. 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. For example
I might say from my home dir
cd t45sdf
and the dir name returned from 'echo $cwd' is the symbolic link
'/home/m248262/t45sdf' but what I want to see is the 'true' directory
'/data/t45sdf/r100/loads'
If you know of a way to resolve this could you please email me at my work
email
Many Thanks!
David Harding m248262@decux1.mdc.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Q? Resolve true pwd, not sym-link
1996-10-25 4:00 Q? Resolve true pwd, not sym-link HARDINGDGH
@ 1996-10-25 4:00 ` Phil Farrell
0 siblings, 0 replies; 2+ messages in thread
From: Phil Farrell @ 1996-10-25 4:00 UTC (permalink / raw)
To: m248262
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1996-10-25 4:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-10-25 4:00 Q? Resolve true pwd, not sym-link HARDINGDGH
1996-10-25 4:00 ` Phil Farrell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox