Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- POW=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -o '[0-9]*%' -m 1)
- PO=${POW::-1}
- case $PO in
- [76-100]*)
- tput setaf 2; echo $POW
- tput sgr0
- ;;
- [50-75]*)
- tput setaf 2; echo $POW
- tput sgr0
- ;;
- [26-49]*)
- tput setaf 3; echo $POW
- tput sgr0
- ;;
- [11-25]*)
- tput setaf 3; echo $POW
- tput sgr0
- ;;
- [0-10]*)
- tput setaf 1; echo $POW
- tput sgr0
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement