aboutsummaryrefslogtreecommitdiff
path: root/battery
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-05-05 15:15:47 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-05-05 15:15:47 -0300
commit2bb9841434e3be1e1735c7b024c4d0572935f639 (patch)
treefd80c5fec195fec5d0ee02bd9244163cea02af81 /battery
parent5dc23d23b5c09c87d74538dd52eb5d2dbe78e8e3 (diff)
downloadscripts-2bb9841434e3be1e1735c7b024c4d0572935f639.tar.gz
scripts-2bb9841434e3be1e1735c7b024c4d0572935f639.tar.bz2
Abort if no battery is available
Diffstat (limited to 'battery')
-rwxr-xr-xbattery5
1 files changed, 5 insertions, 0 deletions
diff --git a/battery b/battery
index 12682d3..487610b 100755
--- a/battery
+++ b/battery
@@ -29,6 +29,11 @@ function battery_capacity {
healthy='#859900'
low='#b58900'
discharge='#dc322f'
+
+# Abort if no battery is available
+if [ ! -e "/sys/class/power_supply/BAT0" ]; then
+ exit
+fi
# Get battery status
if [ -e "/sys/class/power_supply/BAT0/charge" ]; then