Finding the Percentage from a grep variable
-1
votes
3
answers
2463
views
I want to display the calculation of the CPU load in percentage.
num2=$(uptime | grep "average:" | tr -d " " | cut -d ':' -f 5 | cut -d ',' -f 2)
percent=$((num2(*100)))
echo 'CPU percentage' $percent
Am I missing something?
Asked by Zigbii
(125 rep)
Dec 28, 2018, 07:01 PM
Last activity: Sep 14, 2022, 11:09 AM
Last activity: Sep 14, 2022, 11:09 AM