posix fixes
This commit is contained in:
parent
f26304c59b
commit
00534b7cca
1 changed files with 15 additions and 16 deletions
|
@ -19,8 +19,8 @@ esac
|
|||
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"
|
||||
old=$(cat "$cache")
|
||||
echo -n "🪨"
|
||||
echo "$stats" | while read row; do
|
||||
printf "🪨"
|
||||
echo "$stats" | while read -r row; do
|
||||
id=${row%% *}
|
||||
rest=${row#* }
|
||||
total=${rest%% *}
|
||||
|
@ -28,18 +28,17 @@ echo "$stats" | while read row; do
|
|||
|
||||
case "$(echo "$old" | awk '{if ($1 == id)
|
||||
printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \
|
||||
id=$id total=$total idle=$idle)" in
|
||||
id="$id" total="$total" idle="$idle")" in
|
||||
|
||||
"0") echo -n "▁";;
|
||||
"1") echo -n "▂";;
|
||||
"2") echo -n "▃";;
|
||||
"3") echo -n "▄";;
|
||||
"4") echo -n "▅";;
|
||||
"5") echo -n "▆";;
|
||||
"6") echo -n "▇";;
|
||||
"7") echo -n "█";;
|
||||
"8") echo -n "█";;
|
||||
"0") printf "▁";;
|
||||
"1") printf "▂";;
|
||||
"2") printf "▃";;
|
||||
"3") printf "▄";;
|
||||
"4") printf "▅";;
|
||||
"5") printf "▆";;
|
||||
"6") printf "▇";;
|
||||
"7") printf "█";;
|
||||
"8") printf "█";;
|
||||
esac
|
||||
done
|
||||
echo ""
|
||||
done; printf "\\n"
|
||||
echo "$stats" > "$cache"
|
||||
|
|
Loading…
Reference in a new issue