mac compatability is working
This commit is contained in:
parent
ac2f789ff4
commit
0516471e72
2 changed files with 2 additions and 2 deletions
BIN
scripts/.ram_info.sh.swp
Normal file
BIN
scripts/.ram_info.sh.swp
Normal file
Binary file not shown.
|
@ -18,12 +18,12 @@ get_percent()
|
|||
|
||||
Darwin)
|
||||
# percent=$(ps -A -o %mem | awk '{mem += $1} END {print mem}')
|
||||
used_mem=$(vm_stat | grep -i "Pages active:" | sed 's/\.//g' | awk '{printf "%d", $3*4096/1024/1024}')
|
||||
used_mem=$(top -l 1 -s 0 | grep PhysMem | sed 's/[a-z]//g; s/[A-Z]//g; s/[()]//g' | awk '{printf "%d\n", $2-$3-$5}')
|
||||
total_mem=$(system_profiler SPHardwareDataType | grep "Memory:" | awk '{print $2 $3}')
|
||||
if (( $used_mem < 1024 )); then
|
||||
echo $used_mem\M\B/$total_mem
|
||||
else
|
||||
memory=$(($used_mem / 1024))
|
||||
memory=$(($used_mem/1024))
|
||||
echo $memory\G\B/$total_mem
|
||||
fi
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue