From c5f3db4310cb09059b824d2ba7c68883c174bb89 Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Mon, 2 Nov 2020 20:06:22 -0500 Subject: [PATCH] Use total available rather than total in use --- home/lib/login_functions.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 } -- 2.20.1