From 33703eb2d35b5612b9abd041c5e3f9f55fdc9b86 Mon Sep 17 00:00:00 2001 From: Gaganpreet Date: Mon, 31 Aug 2020 11:41:45 +0200 Subject: [PATCH] specify numeric locale for parsing top output --- scripts/cpu_info.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cpu_info.sh b/scripts/cpu_info.sh index c5180cd..92cec3b 100755 --- a/scripts/cpu_info.sh +++ b/scripts/cpu_info.sh @@ -4,7 +4,7 @@ get_percent() { case $(uname -s) in Linux) - percent=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}') + percent=$(LC_NUMERIC=en_US.UTF-8 top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}') echo $percent ;;