From 7b4325a89bdb1295662d38ba21bd158e1e2081cb Mon Sep 17 00:00:00 2001 From: Mattia Basaglia Date: Tue, 22 Mar 2016 18:08:07 +0000 Subject: [PATCH] Fix RAM display for versions of free lacking the cache/buffer-adjusted row --- systempony | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/systempony b/systempony index f987294..9dd76d4 100755 --- a/systempony +++ b/systempony @@ -38,12 +38,12 @@ function pccolor() function ponyget_RAM() { - local ramtable=$(free -h) - local used=$(echo "$ramtable" | sed -n 3p | sed -r "s/ +/\t/g" | cut -f 3) + local ramtable=$(free -h | head -n -1) + local used=$(echo "$ramtable" | tail -n 1 | sed -r "s/ +/\t/g" | cut -f 3) local total=$(echo "$ramtable" | sed -n 2p | sed -r "s/ +/\t/g" | cut -f 2) - ramtable=$(free -m) - local used_M=$(echo "$ramtable" | sed -n 3p | sed -r "s/ +/\t/g" | cut -f 3) + ramtable=$(free -m | head -n -1) + local used_M=$(echo "$ramtable" | tail -n 1 | sed -r "s/ +/\t/g" | cut -f 3) local total_M=$(echo "$ramtable" | sed -n 2p | sed -r "s/ +/\t/g" | cut -f 2) let percent="$used_M * 100 / $total_M"