On Tue, Oct 25, 2005 at 10:13:09PM +0200, Eberhard Moenkeberg wrote:
> On Tue, 25 Oct 2005, Pascal Bleser wrote:
> >Just for the record:
> >awk '/^MemTotal:/{print $2}' /proc/meminfo
> 
> Topped:
> (read a b c; echo $b ) </proc/meminfo

Why doing a fork?  You could do it without a fork as well:

$ read a b c </proc/meminfo; echo $b

But there is a big problem with that solution anyway: It assumes that MemTotal
is the first line in /proc/meminfo.  If one decides to reorder this table in
the kernel or add some headline all your scripts using this solution will
break.

Robert

-- 
Robert Schiele                  Tel.: +49-621-181-2214
Dipl.-Wirtsch.informatiker      mailto:[EMAIL PROTECTED]

Attachment: pgpOFydF2Rjmh.pgp
Description: PGP signature

Reply via email to