Hi, On Tue, 25 Oct 2005, Robert Schiele wrote:
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 )
Why doing a fork? You could do it without a fork as well:
$ read a b c
Right. Topped.
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.
Surely. It was just a sports exercise. If I would need it, I would do grep ^MemTotal /proc/meminfo | (read a b c; echo $b ) and here bash needs the "(...)" to force the subprocess forking at the right point... By this long long traded experience of necessity, I did not see your solution. BTW: Christoph just told me that he is really upset about the ignorance of all the readers here. He had done all his best to cat a good MemTotal value from a real system, but noone did realize it... Cheers -e -- Eberhard Moenkeberg (emoenke@gwdg.de, em@kki.org)