Safer comparison

This commit is contained in:
Dylan 2016-05-13 10:23:07 +10:00
parent fcb128faac
commit 0a2a94c914

View file

@ -1409,9 +1409,12 @@ getmemory () {
;; ;;
"BSD") "BSD")
case "$distro" in
"NetBSD"*) memfree=$(($(awk -F ':|kB' '/MemFree:/ {printf $2}' /proc/meminfo) / 1024)) ;;
*) memfree=$(($(vmstat | awk 'END{printf $5}') / 1024)) ;;
esac
memtotal=$(($(sysctl -n hw.physmem) / 1024 / 1024)) memtotal=$(($(sysctl -n hw.physmem) / 1024 / 1024))
memfree=$(($(vmstat | awk 'END{printf $5}') / 1024))
[ "$distro" == "NetBSD" ] && memfree=$(($(awk -F ':|kB' '/MemFree:/ {printf $2}' /proc/meminfo) / 1024))
memused=$((memtotal - memfree)) memused=$((memtotal - memfree))
;; ;;
esac esac