diff options
Diffstat (limited to 'bin/get_battery_status')
-rwxr-xr-x | bin/get_battery_status | 12 |
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 |