cpu usage script changes

This commit is contained in:
filippo-ferrari 2024-01-28 14:30:16 +01:00
parent 7a57e1280d
commit 9149ffe4e2

View file

@ -19,7 +19,7 @@ esac
stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat) stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat)
[ ! -f $cache ] && echo "$stats" > "$cache" [ ! -f $cache ] && echo "$stats" > "$cache"
old=$(cat "$cache") old=$(cat "$cache")
printf "🪨" printf "🖥️ "
echo "$stats" | while read -r row; do echo "$stats" | while read -r row; do
id=${row%% *} id=${row%% *}
rest=${row#* } rest=${row#* }