Fwd: LFS Script suggestion

Dan Nicholson dbn.lists at gmail.com
Mon Jan 29 00:19:43 PST 2007


On 1/28/07, Alexander E. Patrakov <patrakov at ums.usu.ru> wrote:
> Tushar Teredesai wrote:
> > cat /proc/version | head -n1 | cut -d" " -f1-3,5-7

Pet peeve. Don't use cat to create input streams when the shell is
perfectly capable on it's own with <.

> On a recent Debian installation, this prints:
>
> Linux version 2.6.18-3-686 2.6.18-7) (waldi at debian.org) (gcc
>
> This output doesn't allow one to tell if this kernel is compiled with
> gcc-3.0 or later.
>
> The full /proc/version content, just for the record:
>
> Linux version 2.6.18-3-686 (Debian 2.6.18-7) (waldi at debian.org) (gcc version
> 4.1.2 20061115 (prerelease) (Debian 4.1.1-20)) #1 SMP Mon Dec 4 16:41:14 UTC
> 2006

This would seem to work (maybe the .* is too greedy).

sed -n 's/.*gcc version \([^() ]*\)[() ].*/\1/p;q' < /proc/version

--
Dan



More information about the lfs-dev mailing list