1234567891011121314151617181920212223 |
- #!/bin/sh
- status="/sys/class/power_supply/sbs-20-000b/status"
- current="/sys/class/power_supply/sbs-20-000b/charge_now"
- total="/sys/class/power_supply/sbs-20-000b/charge_full"
- while read line; do
- statusValue=$line
- done < $status
- while read line; do
- currentValue=$line
- done < $current
- while read line; do
- totalValue=$line
- done < $total
- decimal=`echo "scale=4; $currentValue / $totalValue" | bc`
- percent=`echo "$decimal * 100" | bc`
- echo "$statusValue, $percent%"
|