diff options
-rwxr-xr-x | bin/get_mem | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bin/get_mem b/bin/get_mem index fc49561..21cf04a 100755 --- a/bin/get_mem +++ b/bin/get_mem @@ -4,8 +4,12 @@ IFS=$'\n\t' mem_output="" -mem_output="$(free -m| grep "Mem:"| awk '{printf $3 "/" $2 " ("} {printf ("%1.3f", $3/$2)} {printf ")"}')" +if [ "$(uname)" == "Darwin" ]; then + mem_output=$(ps -A -o %mem | awk '{s+=$1} END {print s}') +else + mem_output="$(free -m| grep "Mem:"| awk '{printf $3 "/" $2 " ("} {printf ("%1.3f", $3/$2)} {printf ")"}')" +fi -echo "$mem_output" -exit 0 +echo "$mem_output%" +exit 0 |