dotfiles/.scripts/cpu.sh

7 lines
216 B
Bash
Raw Normal View History

2016-12-16 21:06:16 +00:00
#!/bin/bash
percent=$(top -bn1 | grep "Cpu(s)" | \
sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | \
awk '{print 100 - $1}')
sparks=$(spark 0 $percent 100)
echo "CPU: $(echo "$percent% [${sparks:1:1}]")"