aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2016-03-11 12:49:16 +0100
committerDavid Runge <dave@sleepmap.de>2016-03-11 12:49:16 +0100
commitdaa16bf3603206c64cc8f6d734ba4bdea095ff7f (patch)
tree46888895610621cf93a413db02dced990c54537f
parent4fddd5572d8ae4ddb8f56278c2945b10ed3ce3cb (diff)
downloaddotfiles-daa16bf3603206c64cc8f6d734ba4bdea095ff7f.tar.gz
dotfiles-daa16bf3603206c64cc8f6d734ba4bdea095ff7f.tar.bz2
dotfiles-daa16bf3603206c64cc8f6d734ba4bdea095ff7f.tar.xz
dotfiles-daa16bf3603206c64cc8f6d734ba4bdea095ff7f.zip
bin/get_battery_status: Adding condition to check if there's actually a battery to show.
-rwxr-xr-xbin/get_battery_status12
1 files changed, 7 insertions, 5 deletions
diff --git a/bin/get_battery_status b/bin/get_battery_status
index 5ad18ce..bc4b819 100755
--- a/bin/get_battery_status
+++ b/bin/get_battery_status
@@ -15,11 +15,13 @@ if [ -x /usr/bin/acpi ]; then
battery_percentage=$(echo $acpi_output|cut -d' ' -f4)
battery_percentage=${battery_percentage%","}
battery_percentage=${battery_percentage%"%"}
- if [ $battery_state = "Discharging" ]; then
- battery_remaining=$(echo $acpi_output|cut -d' ' -f5)
- echo "$battery_percentage% ($battery_remaining)"
- else
- echo "$battery_percentage%"
+ if [ $battery_number -ge 0 ]; then
+ if [ $battery_state = "Discharging" ]; then
+ battery_remaining=$(echo $acpi_output|cut -d' ' -f5)
+ echo "$battery_percentage% ($battery_remaining)"
+ else
+ echo "$battery_percentage%"
+ fi
fi
else
exit 1