Fix loop for sxmo_weather.sh

master
Miles Alan 5 years ago
parent 57f6e5897e
commit f25bb821ba
  1. 6
      scripts/appscripts/sxmo_weather.sh

@ -1,6 +1,5 @@
#!/usr/bin/env sh #!/usr/bin/env sh
[ -z "$SXMO_GPSLOCATIONSFILES" ] && SXMO_GPSLOCATIONSFILES="/usr/share/sxmo/places_for_gps.tsv" [ -z "$SXMO_GPSLOCATIONSFILES" ] && SXMO_GPSLOCATIONSFILES="/usr/share/sxmo/places_for_gps.tsv"
NHOURS=72
ROWHOURS=12 ROWHOURS=12
WEATHERXML="" WEATHERXML=""
@ -67,6 +66,7 @@ printtables() {
ROWHOURS="$(echo "$ROWHOURS - $INDENTN" | bc)" ROWHOURS="$(echo "$ROWHOURS - $INDENTN" | bc)"
LASTDAY="" LASTDAY=""
NHOURS=72
# E.g. each while loop iteration handles 1 row # E.g. each while loop iteration handles 1 row
while echo "$TIME" | grep -Eq "[0-9]+" && [ "$NHOURS" -gt 0 ]; do while echo "$TIME" | grep -Eq "[0-9]+" && [ "$NHOURS" -gt 0 ]; do
if [ "$LASTDAY" != "$NOWDAY" ]; then if [ "$LASTDAY" != "$NOWDAY" ]; then
@ -95,10 +95,12 @@ printtables() {
} }
getweathertexttable() { getweathertexttable() {
while true; do
LAT="$1" LAT="$1"
LON="$2" LON="$2"
PLACE="$3" PLACE="$3"
while true; do
clear
downloadweatherxml "$LAT" "$LON" 2>/dev/null downloadweatherxml "$LAT" "$LON" 2>/dev/null
TEMP="$(weatherdata "//temperature" "hourly")" TEMP="$(weatherdata "//temperature" "hourly")"
RAIN="$(weatherdata "//probability-of-precipitation" ".")" RAIN="$(weatherdata "//probability-of-precipitation" ".")"

Loading…
Cancel
Save