Safer comparison
This commit is contained in:
parent
fcb128faac
commit
0a2a94c914
1 changed files with 5 additions and 2 deletions
7
neofetch
7
neofetch
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue