Fwd: LFS Script suggestion
dbn.lists at gmail.com
Mon Jan 29 17:31:05 PST 2007
On 1/29/07, Bruce Dubbs <bruce.dubbs at gmail.com> wrote:
> Dan Nicholson wrote:
> > 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 <.
> > sed -n 's/.*gcc version \([^() ]*\)[() ].*/\1/p;q' < /proc/version
> >From an educational view, what's wrong with showing a different way of
> doing things.
> Actually Tush's version above is much clearer to me than your sed,
> although I don't think the head -n1 is needed (it may be in some cases,
> but not for my systems).
OK, but it still needs to be fixed to work on Debian. Here's the
output from Alexander's version string:
[ 5:28 PM dan at conor] cat foo | head -n1 | cut -d" " -f1-3,5-7
Linux version 2.6.18-3-686 2.6.18-7) (waldi at debian.org) (gcc
It might be best to cat the whole file like he mentioned unless you
want to have a much more heavy duty parser.
More information about the lfs-dev