#!/usr/bin/env bash monitor() { cap=$(cat /sys/class/power_supply/bms/capacity) fcs=$(cat /sys/class/power_supply/ln8000-charger/status) scs=$(cat /sys/class/power_supply/pm8150b-charger/status) [ "$fcs" == "Charging" ] && { echo -ne "${cap}%++\n" return 0 } [ "$scs" == "Charging" ] && { echo -ne "${cap}%+\n" return 0 } echo -ne "${cap}%\n" return 0 } while true; do monitor sleep 10 done