You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
277 B
Plaintext
12 lines
277 B
Plaintext
3 years ago
|
#!/bin/bash
|
||
|
|
||
|
read cpu a b c previdle rest < /proc/stat
|
||
|
prevtotal=$((a+b+c+previdle))
|
||
|
sleep 0.5
|
||
|
read cpu a b c idle rest < /proc/stat
|
||
|
total=$((a+b+c+idle))
|
||
|
cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))
|
||
|
icon=""
|
||
|
printf " %s %s \\n" "$icon" "$cpu%"
|
||
|
|