Merge pull request #63 from gaganpreet/locale-aware-parsing

Specify numeric locale for parsing top output
This commit is contained in:
Ethan Edwards 2020-09-03 13:02:22 -04:00 committed by GitHub
commit e602d9b4eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,7 +16,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
;;