How to find directory name at end of symbolic links
Brian T. White
white at white.cs.unc.edu
Fri Mar 10 08:52:22 AEST 1989
> I am using SunOs 3.5 and want to know how to find out the directory
> name at the end of a series of symbolic links.
>
> Any ideas?
Try this:
#! /bin/csh -f
foreach file ($argv[1-])
echo ""
if (! -e $file) then
echo $file does not exist
continue
endif
echo "$file"
set islink
while ($?islink)
set listing=`ls -ld $file`
echo $listing | grep -s ^lrwx
if ($status) then
unset islink
else
set file=`echo $listing | awk '{print $NF}'`
echo " -> $file"
endif
end
end
echo ""
More information about the Comp.unix.questions
mailing list