Extracting the linked to file name

Anthony Wesley Anthony.Wesley at prometheus.com.au
Wed Nov 14 11:05:12 EST 2001


Rasjid Wilcox wrote:
> 
> I have almost finished my Vet Autodownloader script.
> 
> I have one more thing to resolve.  I need to extract the name of the file that a
> symbolic link points to.  Can anyone suggest a better way than
> 
> filename=`ll symlink.name | sed s/"->"/\|/ | cut -f 2 -d\|`
> 
> as this relies on choosing a character (| in this instance) which you believe
> (and hope) is not in the symlink name.
> 
> Rasjid.


filename=`perl -e 'print readlink("symlink.name")'`

:-)


cheers, Anthony




More information about the linux mailing list