mirror of
https://github.com/dylanaraps/neofetch.git
synced 2025-10-04 01:00:17 +00:00
Fix memory usage on BSD
This commit is contained in:
26
fetch
26
fetch
@@ -641,25 +641,23 @@ getmemory () {
|
||||
memory="${memused}MB / ${memtotal}MB"
|
||||
;;
|
||||
|
||||
"FreeBSD")
|
||||
memtotal=$(dmesg | awk '/real mem/ {printf $5}')
|
||||
memtotal=${memtotal/\(/}
|
||||
memtotal=${memtotal/)MB/}
|
||||
memfree=$(top -d 1 | awk '/Mem:/ {printf $10}')
|
||||
memfree=${memfree/M/}
|
||||
memused=$((memtotal - memfree))
|
||||
|
||||
memory="${memused}MB / ${memtotal}MB"
|
||||
;;
|
||||
|
||||
*"BSD")
|
||||
"BSD")
|
||||
memtotal=$(dmesg | awk '/real mem/ {printf $5}')
|
||||
memtotal=${memtotal/\(/}
|
||||
memtotal=${memtotal/MB\)/}
|
||||
memfree=$(top -d 1 | awk '/Real:/ {print $6}')
|
||||
|
||||
case "$distro" in
|
||||
"FreeBSD")
|
||||
memfree=$(top -d 1 | awk '/Mem:/ {printf $10}')
|
||||
;;
|
||||
|
||||
*)
|
||||
memfree=$(top -d 1 | awk '/Real:/ {print $6}')
|
||||
;;
|
||||
esac
|
||||
|
||||
memfree=${memfree/M/}
|
||||
memused=$((memtotal - memfree))
|
||||
|
||||
memory="${memused}MB / ${memtotal}MB"
|
||||
;;
|
||||
|
||||
|
Reference in New Issue
Block a user