From 738c65dbff0ad9a3f9ad1b09a75d8a99aebfad66 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Sat, 8 Jan 2022 14:14:05 +0900 Subject: [PATCH] plugins/battery: Refactor extraction of percentage without a non-POSIX option --- plugins/battery/battery.plugin.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/battery/battery.plugin.sh b/plugins/battery/battery.plugin.sh index 914a899..47c7621 100644 --- a/plugins/battery/battery.plugin.sh +++ b/plugins/battery/battery.plugin.sh @@ -61,7 +61,7 @@ battery_percentage(){ if command_exists upower; then - local UPOWER_OUTPUT=$(_omb_plugin_battery__upower_print_info | grep percentage | tail --bytes 5) + local UPOWER_OUTPUT=$(_omb_plugin_battery__upower_print_info | sed -n 's/.*percentage[:[:blank:]]*\([0-9%]\{1,\}\)$/\1/p') echo ${UPOWER_OUTPUT: : -1} elif command_exists acpi; then