Symbolic links and Bourne shell...

Randal Schwartz merlyn at iwarp.intel.com
Sat Sep 8 03:26:57 AEST 1990


In article <1990Sep7.140159.4832 at usenet.ins.cwru.edu>, boysko at dsrgsun (Glenn Boysko) writes:
| In Bourne shell, how can you find the path pointed to be a symbolic link?
| However, in Bourne shell, pwd returns the same value as SYMLINK.  Does anyone
| know how to get this info in a Bourne shell without typing:
| 
| 	% linkpath="`csh -c 'cd $SYMLINK; pwd'`"

I use /bin/pwd, as in:

	(cd /SOMEWHERE/THAT/MAY/BE/A/SYMLINK; /bin/pwd)

which avoids any builtin pwd command (in either sh or csh) that may be
fooled by the presence of symlinks.

I also have a script (in Perl, natch) that expands symlinks step by
step to tell me how "expensive" they are (we had a lot of off-machine
symlinks that were pointing to other possibly on-machine directories
that were causing a lot of net traffic).

Just another Unix hacker,
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn at iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/



More information about the Comp.unix.questions mailing list