mac compatability is working

This commit is contained in:
Ethan Edwards 2020-06-28 13:34:08 -04:00
parent ac2f789ff4
commit 0516471e72
2 changed files with 2 additions and 2 deletions

BIN
scripts/.ram_info.sh.swp Normal file

Binary file not shown.

View file

@ -18,12 +18,12 @@ get_percent()
Darwin) Darwin)
# percent=$(ps -A -o %mem | awk '{mem += $1} END {print mem}') # 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}') total_mem=$(system_profiler SPHardwareDataType | grep "Memory:" | awk '{print $2 $3}')
if (( $used_mem < 1024 )); then if (( $used_mem < 1024 )); then
echo $used_mem\M\B/$total_mem echo $used_mem\M\B/$total_mem
else else
memory=$(($used_mem / 1024)) memory=$(($used_mem/1024))
echo $memory\G\B/$total_mem echo $memory\G\B/$total_mem
fi fi
;; ;;