#! /bin/bash battery=$(cat /sys/class/power_supply/BAT0/capacity) charging=$(acpi | grep Charging -o) if [ "$charging" = "Charging" ]; then s0="" s1="" s2="" s3="" s4="" s5="" s6="" s7="" else s0="" s1="" s2="" s3="" s4="" s5="" s6="" s7="" fi # check capacity if(( $battery>95 )) then batt_out="$s0" elif(( $battery>85 )) then batt_out="$s1" elif(( $battery>70 )) then batt_out="$s2" elif(( $battery>60 )) then batt_out="$s3" elif(( $battery>45 )) then batt_out="$s4" elif(( $battery>30 )) then batt_out="$s5" elif(( $battery>20 )) then batt_out="$s6" #echo $batt_out $battery% | grep --color . #exit else batt_out="$s7" #echo $batt_out $battery% | grep --color . #exit fi echo $batt_out $battery%