Safer comparison

This commit is contained in:
Dylan 2016-05-13 10:23:07 +10:00
parent fcb128faac
commit 0a2a94c914
1 changed files with 5 additions and 2 deletions

View File

@ -1409,9 +1409,12 @@ getmemory () {
;;
"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))
memfree=$(($(vmstat | awk 'END{printf $5}') / 1024))
[ "$distro" == "NetBSD" ] && memfree=$(($(awk -F ':|kB' '/MemFree:/ {printf $2}' /proc/meminfo) / 1024))
memused=$((memtotal - memfree))
;;
esac