Last active
December 17, 2015 04:48
-
-
Save ngty/5552730 to your computer and use it in GitHub Desktop.
Generating battery status
This file contains 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 | |
if [ "$(acpi -a | awk '{print $3}' | tr [a-z] [A-Z])" == "ON-LINE" ]; then | |
if [ "$(acpi -b | awk '{print $4}')" == "100%" ]; then | |
echo -n "100%" | |
else | |
echo -n "$( | |
acpi -b | \ | |
awk '{gsub(",",""); print $4 "(+" $5}' | \ | |
awk -F: '{print $1 ":" $2 ")"}' | |
)" | |
fi | |
else | |
echo -n "$( | |
acpi -b | \ | |
awk '{gsub(",",""); print $4 "(-" $5}' | \ | |
awk -F: '{print $1 ":" $2 ")"}' | |
)" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment