Displaying free RAM

I need access to the current amount of free RAM for a script I’m writing. I’d like to use ‘do shell script: “top | grep PhysMem”’ or something and then go from there, but the problem is that top constantly updates the info which makes it hard to use it in a script. If there is any way to get top to simply print the current info once and then quitting or any other method of getting the current free ram, it would be great.

Any help appreciated.

Hi,

do shell script “system_profiler -detailLevel -2 | awk ‘/Memory/{print $2}’”

Model: PowerBook G4 Titanium 550
AppleScript: 1.1.0
Browser: Safari 412.2.2
Operating System: Mac OS X (10.4)

Is a near useless statistic, but:

top -ce -l1 -n 0 -R -F | grep PhysMem | awk -F ', ’ ‘{print $5}’

top -l 1 | grep PhysMem

try:

vm_stat | awk ‘/free:/ {print $3*4/1024 " MB Free"}’

Andy

Awesome. Thanks guys.