Added tests for WMIC

This commit is contained in:
Nils Winkler
2017-10-24 07:40:42 +02:00
parent 601202e816
commit 7602b1da32
2 changed files with 60 additions and 9 deletions

View File

@@ -72,15 +72,8 @@ battery_percentage(){
echo ${IOREG_OUTPUT:--1}
elif _command_exists WMIC;
then
local WINPC=$(echo porcent=$(WMIC PATH Win32_Battery Get EstimatedChargeRemaining /Format:List) | grep -o '[0-9]*')
case $WINPC in
100*)
echo '100'
;;
*)
echo $WINPC
;;
esac
local WINPC=$(WMIC PATH Win32_Battery Get EstimatedChargeRemaining /Format:List | grep -o '[0-9]\+' | head -1)
echo ${WINPC:--1}
else
echo "no"
fi