#!/bin/sh
if [ -f /sys/class/power_supply/sony_controller_battery_*/capacity ]; then
  percentage=$(cat /sys/class/power_supply/sony_controller_battery_*/capacity)
  if [ percentage -lt 40 ]; then
    printf "%s%%" "$percentage"
    exit
  fi
  if [ percentage -lt 20 ]; then
    printf "%s%%" "$percentage"
    exit
  fi
  printf "%s%%" "$percentage"
fi