[plug] my Linux is too young! Need older "tail" and "head"

Bernd Felsche bernie at innovative.iinet.net.au
Thu Jul 1 09:08:22 WST 2004


On Wednesday 30 June 2004 23:13, Denis Brown wrote:
> On Wed, 30 Jun 2004, Craig Ringer wrote:
> > Earlier, I wrote:
> > > Are you sure you're not running into another issue - for example, a
> > > shell-provided 'tail' that takes different syntax? Have you tried
> > > '/bin/sh /path/to/install/script.sh' to see if that helps?
> >
> > Nope, it looks like Cameron has it pinned down. Sorry for the noise.

> I don't think noise comes into it :-)   You mentioned the executable
> nature of the libc and I had a look at my Gentoo installation.   The
> symlink is set executable and when I, as a normal user, invoke
> /lib/libc.so.6 I too get rewarded with interesting info.

> If anyone is interested the full line of code that extracts the
> version number is

> ver='/lib/libc.so.6 | head -1 | sed -e "s/^[^0-9]*//" -e "s/[ ,].*$//"'

You don't actually need head/tail to do the job. sed can quit after
the first line.

  ver='/lib/libc.so.6 | sed -e 's/^[^0-9]*\([0-9.]*\).*$/\1/' -e q`

I prefer placing regular expressions in single quotes so that a
shell doesn't try to do a expansion.

-- 
/"\ Bernd Felsche - Innovative Reckoning, Perth, Western Australia
\ /  ASCII ribbon campaign | I'm a .signature virus!
 X   against HTML mail     | Copy me into your ~/.signature
/ \  and postings          | to help me spread!





More information about the plug mailing list