Extracting the linked to file name

David Clarke gadicath at yahoo.com
Wed Nov 14 11:06:16 EST 2001


On Wed, 14 Nov 2001, Rasjid Wilcox wrote:
> 
> filename=`ll symlink.name | sed s/"->"/\|/ | cut -f 2 -d\|`
> 

Just wondering, do you want the full path of the file the link points
to?  If you do this should work:

filename=`ls -la linkname | awk '{print $11}'`

If you just want the actual filename, no path, then this should work:

filename=$(basename `ls -la /bin/mt | awk '{print $11}'`)

Not sure if the above will work for anything except bash.

	Hope this helps.

-- 
Don't tell me I'm burning the candle at both ends -- tell me where to
get more wax!!
-
David Clarke <gadicath at yahoo.com> | David Clarke <s3353950>
GPG Fingerprint :  869B 53DD 5E80 E1F0 93F6  9871 0508 0296 5957 F723




More information about the linux mailing list