31 lines
498 B
Bash
Executable File
31 lines
498 B
Bash
Executable File
#!/bin/sh
|
|
|
|
STATUS=$(sysctl -nh hw.acpi.battery.state)
|
|
LOAD=$(sysctl -nh hw.acpi.battery.life)
|
|
|
|
if [ $STATUS = 2 ]
|
|
then
|
|
# cargando
|
|
echo $LOAD%
|
|
elif [ $STATUS = 1 ]
|
|
then
|
|
#descargando
|
|
if [ $LOAD -lt 6 ]
|
|
then
|
|
echo $LOAD%
|
|
elif [ $LOAD -lt 26 ]
|
|
then
|
|
echo $LOAD%
|
|
elif [ $LOAD -lt 56 ]
|
|
then
|
|
echo $LOAD%
|
|
elif [ $LOAD -lt 81 ]
|
|
then
|
|
echo $LOAD%
|
|
else
|
|
echo $LOAD%
|
|
fi
|
|
else
|
|
echo $LOAD%
|
|
fi
|