From c0b9964a5a6383f12bcff0528d6db6548d39f2a8 Mon Sep 17 00:00:00 2001 From: Andros Fenollosa Date: Thu, 7 Apr 2016 10:33:40 +0200 Subject: [PATCH] Fix segurity --- battery_health.60s.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/battery_health.60s.sh b/battery_health.60s.sh index 87d7693..6864fbf 100755 --- a/battery_health.60s.sh +++ b/battery_health.60s.sh @@ -4,6 +4,7 @@ # v1.0 # Andros Fenollosa # tanrax +# https://programadorwebvalencia.com/wp-content/uploads/2016/04/Screen-Shot-2016-04-05-at-12.47.25.jpg # Shows power percentaje and notice when you load # 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