specify numeric locale for parsing top output
This commit is contained in:
parent
fbc02789b4
commit
33703eb2d3
1 changed files with 1 additions and 1 deletions
|
@ -4,7 +4,7 @@ get_percent()
|
||||||
{
|
{
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Linux)
|
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
|
echo $percent
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue