Fix segurity

This commit is contained in:
Andros Fenollosa 2016-04-07 10:33:40 +02:00
parent a46a3d9919
commit c0b9964a5a

View File

@ -4,6 +4,7 @@
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Andros Fenollosa</bitbar.author>
# <bitbar.author.github>tanrax</bitbar.author.github>
# <bitbar.image>https://programadorwebvalencia.com/wp-content/uploads/2016/04/Screen-Shot-2016-04-05-at-12.47.25.jpg</bitbar.image>
# <bitbar.desc>Shows power percentaje and notice when you load</bitbar.desc>
# Variables
@ -34,7 +35,7 @@ function changeStatus {
function batteryLow {
LOW=True
changeStatus "Battery Low" $BATTERY% "Blow"
changeStatus "Battery Low" "$BATTERY"% "Blow"
}
function batteryNormal {
@ -44,15 +45,15 @@ function batteryNormal {
function batteryHigh {
HIGH=True
changeStatus "Battery high" $BATTERY% "Blow"
changeStatus "Battery high" "$BATTERY"% "Blow"
}
# Logic
if [ $BATTERY -le $POR_LOW ] && [ $LOW = False ]; then
if [ "$BATTERY" -le $POR_LOW ] && [ $LOW = False ]; then
batteryLow
elif [ $BATTERY -ge $POR_HIGH ] && [ $HIGH = False ]; then
elif [ "$BATTERY" -ge $POR_HIGH ] && [ $HIGH = False ]; then
batteryHigh
elif [ $BATTERY -le $POR_HIGH ] && [ $BATTERY -ge $POR_LOW ]; then
elif [ "$BATTERY" -le $POR_HIGH ] && [ "$BATTERY" -ge $POR_LOW ]; then
batteryNormal
fi
@ -60,12 +61,12 @@ fi
echo "$LOW|$HIGH" > "$SAVE_LOCATION";
# View battery
if [ $TYPE = 'AC' ]; then
echo $AC $BATTERY%
if [ "$TYPE" = "AC" ]; then
echo $AC "$BATTERY"%
else
if [ $HIGH = True ] || [ $LOW = True ]; then
echo $BAD $BATTERY%
echo $BAD "$BATTERY"%
else
echo $BATTERY%
echo "$BATTERY"%
fi
fi