On 1/29/07, Bruce Dubbs <[EMAIL PROTECTED]> wrote: > > Linux version 2.6.9-42.0.3.EL_lustre.1.5.97smp ([EMAIL PROTECTED]) (gcc > version 3.4.4 20050721 (Red Hat 3.4.4-2)) #1 SMP Fri Jan 12 17:22:43 MST > 2007 > > And Alex: > > Linux version 2.6.18-3-686 (Debian 2.6.18-7) ([EMAIL PROTECTED]) (gcc > version 4.1.2 20061115 (prerelease) (Debian 4.1.1-20)) #1 SMP Mon Dec 4 > 16:41:14 UTC 2006 > > How about: > > $ sed -r 's/.*(gcc version [01234567890\.]+).*/\1/' /proc/version > gcc version 4.0.3 > > I don't like all those backslashes. :)
That's cool. I think you can still reduce the bracketed part to [0-9\.]. However, the way it works now is that it prints your kernel version and the associated gcc version. So, it needs a bit more work. Oh, and distros often tend to add extra version fields to their packages with - and _. This is what I came up with, which unfortunately is getting long again. Alexander might be right that `cat /proc/version' is the way to go. $ sed -r 's/.*(Linux version [^ ]+).*(gcc version [^ ()]+).*/\1 \2/' /proc/version Linux version 2.6.18.6-7 gcc version 4.0.3 And what it does for the Debian system. $ sed -r 's/.*(Linux version [^ ]+).*(gcc version [^ ()]+).*/\1 \2/' foo Linux version 2.6.18-3-686 gcc version 4.1.2 -- Dan -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
