Nemo's bash challenge for the day

Michael Still mikal at stillhq.com
Fri Mar 29 14:43:05 EST 2002


On Fri, 29 Mar 2002, David Price wrote:

> On Fri, Mar 29, 2002 at 11:31:26AM +1100, Nemo - earth native wrote:
> > While we're talking bash scripts... does anyone know an easier way of
> > doing this:
> >
> > #!/bin/sh
> > basename `ls -o $1 | awk -F " "  '{ print $10}'`
> >
> > (call it with $1 as a symbolic link, and it returns the name of the file
> > it's linked to)
> >
> > .../Nemo
> >
>
> I have a /bin/readlink which does some of what you want.  It looks
> like it's in package "debianutils", so I'm not sure if it's available
> on the majority of systems.  Also, it doesn't do exactly the same,
> since it recursively follows symlinks - but I would guess that would
> usually be what is wanted.

My redhat 6.1 sparc box lacks it, my redhat 7.1 intel box does have it.

Mikal

-- 

Michael Still (mikal at stillhq.com)     UMT+11hrs





More information about the linux mailing list