dotfiles/.scripts/cpu.sh
2016-12-16 13:06:16 -08:00

6 lines
216 B
Bash
Executable file

#!/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}]")"