Created
October 24, 2015 17:45
-
-
Save bylatt/dede4e1fccff271bf2ff to your computer and use it in GitHub Desktop.
Show battery status on mac os x
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| percent=$(pmset -g batt | egrep "([0-9]+\%).*" -o | cut -f1 -d'%') | |
| args=("$@") | |
| if [ "${args[0]}" == "debug" ]; then | |
| echo "$percent" | |
| fi | |
| if [ "$percent" -gt "80" ]; then | |
| result="★ ★ ★ ★ ★ " | |
| elif [ "$percent" -gt "60" ]; then | |
| result="★ ★ ★ ★ ☆ " | |
| elif [ "$percent" -gt "40" ]; then | |
| result="★ ★ ★ ☆ ☆ " | |
| elif [ "$percent" -gt "20" ]; then | |
| result="★ ★ ☆ ☆ ☆ " | |
| elif [ "$percent" -gt "0" ]; then | |
| result="★ ☆ ☆ ☆ ☆ " | |
| fi | |
| echo "$result" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment