From 1434ccf47a77c3981979de3dbfc627083529d8ac Mon Sep 17 00:00:00 2001 From: Mattia Basaglia Date: Fri, 22 Apr 2016 20:14:26 +0100 Subject: [PATCH] Improve CPU_Usage formatting --- README | 1 + systempony | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README b/README index 871ca2f..e336bc0 100644 --- a/README +++ b/README @@ -43,6 +43,7 @@ Config Variables: Requirements: * lsb-release for Distro * lxc for Containers + * bc for CPU_Usage Generating Images ----------------- diff --git a/systempony b/systempony index 77a4bb1..b435471 100755 --- a/systempony +++ b/systempony @@ -83,7 +83,7 @@ function ponyget_CPU() function ponyget_CPU_Usage() { - echo "$(top -b -n1 | grep "Cpu(s):" | sed -r -e "s/^[^0-9]+//" -e "s/[^0-9]+,\s+/ + /g" -e "s/[^0-9]+$//" | cut -d ' ' -f 1-5 | bc)%" + printf %.1f%% "$(top -b -n1 | grep "Cpu(s):" | sed -r -e "s/^[^0-9]+//" -e "s/[^0-9]+,\s+/ + /g" -e "s/[^0-9]+$//" | cut -d ' ' -f 1-5 | bc)" } function ponyget_Uptime()