Completed tests for upower command

This commit is contained in:
Nils Winkler
2017-10-23 07:39:08 +02:00
parent d39d14b140
commit b7b8a0afe0
2 changed files with 15 additions and 6 deletions

View File

@@ -55,8 +55,8 @@ battery_percentage(){
if _command_exists upower;
then
local UPOWER_OUTPUT=$(upower --show-info $(upower --enumerate | grep BAT) | grep percentage | tail --bytes 5)
echo ${UPOWER_OUTPUT: : -1}
local UPOWER_OUTPUT=$(upower --show-info $(upower --enumerate | grep BAT) | grep percentage | grep -o "[0-9]\+" | head -1)
echo ${UPOWER_OUTPUT:--1}
elif _command_exists acpi;
then
local ACPI_OUTPUT=$(acpi -b)