mirror of
https://gitlab.com/mattia.basaglia/ASCII-Pony.git
synced 2024-11-25 13:28:00 +01:00
Fix RAM display for versions of free lacking the cache/buffer-adjusted row
This commit is contained in:
parent
a592ea89d7
commit
7b4325a89b
1 changed files with 4 additions and 4 deletions
|
@ -38,12 +38,12 @@ function pccolor()
|
||||||
|
|
||||||
function ponyget_RAM()
|
function ponyget_RAM()
|
||||||
{
|
{
|
||||||
local ramtable=$(free -h)
|
local ramtable=$(free -h | head -n -1)
|
||||||
local used=$(echo "$ramtable" | sed -n 3p | sed -r "s/ +/\t/g" | cut -f 3)
|
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)
|
local total=$(echo "$ramtable" | sed -n 2p | sed -r "s/ +/\t/g" | cut -f 2)
|
||||||
|
|
||||||
ramtable=$(free -m)
|
ramtable=$(free -m | head -n -1)
|
||||||
local used_M=$(echo "$ramtable" | sed -n 3p | sed -r "s/ +/\t/g" | cut -f 3)
|
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)
|
local total_M=$(echo "$ramtable" | sed -n 2p | sed -r "s/ +/\t/g" | cut -f 2)
|
||||||
let percent="$used_M * 100 / $total_M"
|
let percent="$used_M * 100 / $total_M"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue