From: Siraaj Khandkar Date: Tue, 3 Nov 2020 01:06:22 +0000 (-0500) Subject: Use total available rather than total in use X-Git-Url: https://git.xandkar.net/?p=khome.git;a=commitdiff_plain;h=c5f3db4310cb09059b824d2ba7c68883c174bb89 Use total available rather than total in use --- diff --git a/home/lib/login_functions.sh b/home/lib/login_functions.sh index 2577531..c4a583a 100644 --- a/home/lib/login_functions.sh +++ b/home/lib/login_functions.sh @@ -514,13 +514,12 @@ motd() { printf '%smem by proc\n' "$indent_unit" ps -eo rss,cmd \ - | awk ' + | awk -v total="$(free | awk '$1 == "Mem:" {print $2; exit}')" ' NR > 1 { rss = $1 cmd = $2 n = split(cmd, path, "/") # _may_ be a path proc = path[n] - total += rss by_proc[proc] += rss }