#!/usr/bin/env bash ac_status=$(cat /sys/class/power_supply/AC/online) bat_status=$(cat /sys/class/power_supply/BAT0/status) bat_lvl=$(cat /sys/class/power_supply/BAT0/capacity) if (("$ac_status" == 0)); then echo "$bat_status - $bat_lvl%" else if [ "$bat_lvl" -lt "90" ]; then echo "$bat_status - $bat_lvl%" fi fi