scripts/attic/btpower.sh

12 lines
253 B
Bash

#!/bin/sh
DEVICES=$(upower -e)
for device in $DEVICES; do
info=$(upower -i $device)
echo "$info"
model=$(echo "$info" | grep -oP 'model: \K\w+[a-zA-Z0-9 ]*$')
battery=$(echo "$info" | grep -oP 'percentage: [0-9 ]*%')
echo "$model: $battery"
done