[OT] Re: Dereferencing symbolic links

Chris F.A. Johnson c.f.a.johnson at home.com
Wed Jul 4 16:11:46 PDT 2001


On Thu, 5 Jul 2001, Florian Bachmann wrote:

> I need this for a shell script I am writing that compresses manual pages in
> bzip2 format. Is there some way of dereferncing a symbol link - I use "test
> -L" to check if it is a symbolic link, but now I need to know the file that
> link references. I ended up writing a small C program using the read_link()
> glibc call, but there probably is a standard utility around that does just
> that.

This would be more appropriate in lfs-apps.

> Any hints on this one would be greatly appreciated.

realfile=`ls -l FILE | cut -d '>' -f2`

or

realfile=`ls -l FILE`
realfile=${file#*> }

-- 
	Chris F.A. Johnson	    bq933 at torfree.net
	=================================================================
	c.f.a.johnson at home.com	    http://cfaj.freeshell.org
	cfaj at freeshell.org	    http://members.home.net/c.f.a.johnson

-- 
Unsubscribe: send email to lfs-discuss-request at linuxfromscratch.org
and put unsubscribe in the subject header of the message



More information about the lfs-dev mailing list