From: Silvio Rhatto Date: Mon, 5 May 2014 18:15:47 +0000 (-0300) Subject: Abort if no battery is available X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=2bb9841434e3be1e1735c7b024c4d0572935f639;p=scripts.git Abort if no battery is available --- 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