On 1/28/07, Alexander E. Patrakov <[EMAIL PROTECTED]> 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) ([EMAIL PROTECTED]) (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) ([EMAIL PROTECTED]) (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
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to