Type (copy and paste) the following line in the Terminal:
system_profiler SPMemoryDataType | grep -e 'Size: [0-9]' | awk '{print $2}' | perl -e '$sum=0; while (<>) { $sum+=$_;} print "$sum\n";'
The output will be the amount of the memory on your Mac.
Funny? I found this exercise in a nice book "Beginning Mac OS X Snow Leopard Programming".
If you want to understand what's going on, you need to test sequemtially each part:
system_profiler SPMemoryDataType
system_profiler SPMemoryDataType | grep -e 'Size: [0-9]'
system_profiler SPMemoryDataType | grep -e 'Size: [0-9]' | awk '{print $2}'
system_profiler SPMemoryDataType | grep -e 'Size: [0-9]' | awk '{print $2}' | perl -e '$sum=0; while (<>) { $sum+=$
No comments:
Post a Comment