#!/usr/bin/env bash cap="$(cat /sys/class/power_supply/BAT0/capacity)" if [ "$cap" -ge 33 ];then color="\x01" elif [ "$cap" -ge 10 ]; then color="\x03" else color="\x04" fi echo -n -e "$color $cap% \x01"