From 0a2a94c914b0a239ec4b91e55c8812df093f5610 Mon Sep 17 00:00:00 2001 From: Dylan Date: Fri, 13 May 2016 10:23:07 +1000 Subject: [PATCH] Safer comparison --- neofetch | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index c00fa3c6..f5024e8b 100755 --- a/neofetch +++ b/neofetch @@ -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