Fix memory output on OpenBSD

This commit is contained in:
Dylan 2016-03-26 09:45:46 +11:00
parent 17cd68ba6b
commit 030263465f
1 changed files with 8 additions and 1 deletions

View File

@ -1134,7 +1134,14 @@ getmemory () {
"OpenBSD" | "BSD")
case "$distro" in
"OpenBSD"* | "FreeBSD"*)
"OpenBSD"*)
mem=($(top -d 1 | awk -F ': |/| |M' '/Memory:/ {printf $4 " " $6 " " $11 "\n"}'))
memtotal=$((${mem[1]} + ${mem[2]}))
memused=$((memtotal - ${mem[0]}))
memory="${memused}MB / ${memtotal}MB"
;;
"FreeBSD"*)
memtotal=$(dmesg | awk '/real mem/ {printf $5}')
memtotal=${memtotal/\(}
memtotal=${memtotal/MB\)}