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.version>v1.0</bitbar.version>
# <bitbar.author>Andros Fenollosa</bitbar.author> # <bitbar.author>Andros Fenollosa</bitbar.author>
# <bitbar.author.github>tanrax</bitbar.author.github> # <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> # <bitbar.desc>Shows power percentaje and notice when you load</bitbar.desc>
# Variables # Variables
@ -34,7 +35,7 @@ function changeStatus {
function batteryLow { function batteryLow {
LOW=True LOW=True
changeStatus "Battery Low" $BATTERY% "Blow" changeStatus "Battery Low" "$BATTERY"% "Blow"
} }
function batteryNormal { function batteryNormal {
@ -44,15 +45,15 @@ function batteryNormal {
function batteryHigh { function batteryHigh {
HIGH=True HIGH=True
changeStatus "Battery high" $BATTERY% "Blow" changeStatus "Battery high" "$BATTERY"% "Blow"
} }
# Logic # Logic
if [ $BATTERY -le $POR_LOW ] && [ $LOW = False ]; then if [ "$BATTERY" -le $POR_LOW ] && [ $LOW = False ]; then
batteryLow batteryLow
elif [ $BATTERY -ge $POR_HIGH ] && [ $HIGH = False ]; then elif [ "$BATTERY" -ge $POR_HIGH ] && [ $HIGH = False ]; then
batteryHigh batteryHigh
elif [ $BATTERY -le $POR_HIGH ] && [ $BATTERY -ge $POR_LOW ]; then elif [ "$BATTERY" -le $POR_HIGH ] && [ "$BATTERY" -ge $POR_LOW ]; then
batteryNormal batteryNormal
fi fi
@ -60,12 +61,12 @@ fi
echo "$LOW|$HIGH" > "$SAVE_LOCATION"; echo "$LOW|$HIGH" > "$SAVE_LOCATION";
# View battery # View battery
if [ $TYPE = 'AC' ]; then if [ "$TYPE" = "AC" ]; then
echo $AC $BATTERY% echo $AC "$BATTERY"%
else else
if [ $HIGH = True ] || [ $LOW = True ]; then if [ $HIGH = True ] || [ $LOW = True ]; then
echo $BAD $BATTERY% echo $BAD "$BATTERY"%
else else
echo $BATTERY% echo "$BATTERY"%
fi fi
fi fi