Gentoo Archives: gentoo-dev

From: Ed Grimm <paranoid@××××××××××××××××××××××.org>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] what to do when an ebuild needs loads of RAM?
Date: Fri, 19 Nov 2004 06:17:16
Message-Id: Pine.LNX.4.60.0411190604060.5623@mbeq.rq.iarg
In Reply to: [gentoo-dev] what to do when an ebuild needs loads of RAM? by kosmikus
1 On Thu, 18 Nov 2004, kosmikus wrote:
2
3 <snip what everyone's talked about already>
4
5 > function get-memory-total() {
6 > cat /proc/meminfo | grep MemTotal | sed -r "s/[^0-9]*([0-9]+).*/\1/"
7 > }
8
9 cat | grep | (sed|awk) lines have always bothered me to no end. How
10 about, instead, one of the following function bodies:
11
12 awk '/MemTotal/ { print $2}' /proc/meminfo
13 sed -r -e '/MemTotal/!d' -e 's/[^0-9]*([0-9]+).*/\1/' /proc/meminfo
14 perl -ne '/MemTotal:\s+(\d+)/ && print "$1\n"' /proc/meminfoo
15 grep MemTotal | (read tag size units; echo $size)
16
17 Normally, I wouldn't bring it up, but there's *so* many ways to do that
18 better, it's sad. Note that I could've listed many more, but that
19 would've been sad as well. (Actually, even this much is somewhat sad.)
20 Personally, I'd vote for the first or third of this group.
21
22 Ed
23
24 --
25 gentoo-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] what to do when an ebuild needs loads of RAM? Ciaran McCreesh <ciaranm@g.o>
Re: [gentoo-dev] what to do when an ebuild needs loads of RAM? "Ilya A. Volynets-Evenbakh" <iluxa@g.o>