#!/usr/bin/env bash # Outputs battery charge percentage and status # e.g. Battery 0: 85% (Discharging) for bi in /sys/class/power_supply/BAT*; do [ -f "${bi}" ] && echo "Battery ${bi:27:1}: $(cat ${bi}/capacity)% ($(cat ${bi}/status))" done