1 |
On Fri, 2004-11-19 at 04:03 -0500, Aaron Walker wrote: |
2 |
|
3 |
> | |
4 |
> | function get-memory-total() { |
5 |
> | cat /proc/meminfo | grep MemTotal | sed -r "s/[^0-9]*([0-9]+).*/\1/" |
6 |
> | } |
7 |
> |
8 |
> eureka! what happens when the host OS doesn't have /proc/meminfo? |
9 |
|
10 |
[snip] |
11 |
|
12 |
> I have no problem with what the above code is trying to achieve, just how it |
13 |
> goes about doing so. At the very least, it shouldn't assume the existence of a |
14 |
> procfs. |
15 |
> |
16 |
> If you do decide to handle your problem by checking the amount of RAM, please |
17 |
> find an alternate way (obviously 'free' can't be used either) or at the very |
18 |
> minimum check for file existence. |
19 |
|
20 |
Can you think of a nice portable way of doing this test? That would be |
21 |
really helpful. |
22 |
|
23 |
Duncan |
24 |
|
25 |
|
26 |
-- |
27 |
gentoo-dev@g.o mailing list |