Fix: Memory usage using raw numbers

Use free without -h to get raw numbers to report correct memory usage,
otherwise when the free memory is a lower order of magnitude than the
total memory, e.g., the free memory is in MiB and the total memory
is in GiB, then the human-readable free memory number will be too
large compared to the total memory number.
This commit is contained in:
Narvin Singh 2020-12-24 10:46:11 -05:00
parent deca8326c1
commit fc8f655bb7

View File

@ -32,7 +32,7 @@ status_cpu() {
}
status_mem() {
printf '%.0f%%' "$(free -h | awk 'NR == 2 {print $3 * 100 / $2}')"
printf '%.0f%%' "$(free | awk 'NR == 2 {print $3 * 100 / $2}')"
}
status_bl () {