From fe15eb6755f04535358c9bea6caf2e2a5ac3357c Mon Sep 17 00:00:00 2001 From: Miles Alan Date: Thu, 9 Jul 2020 18:18:32 -0500 Subject: [PATCH] Loop weather script fetch/display logic --- scripts/appscripts/sxmo_weather.sh | 32 ++++++++++++++++-------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/scripts/appscripts/sxmo_weather.sh b/scripts/appscripts/sxmo_weather.sh index 8d8b281..04420e8 100755 --- a/scripts/appscripts/sxmo_weather.sh +++ b/scripts/appscripts/sxmo_weather.sh @@ -95,21 +95,23 @@ printtables() { } getweathertexttable() { - LAT="$1" - LON="$2" - PLACE="$3" - downloadweatherxml "$LAT" "$LON" 2>/dev/null - TEMP="$(weatherdata "//temperature" "hourly")" - RAIN="$(weatherdata "//probability-of-precipitation" ".")" - WIND="$(weatherdata "//wind-speed" ".")" - #LOCATION="$(weatherdata "//location/description" ".")" - TIME="$( - weatherdata "//start-valid-time" "." | - grep -oE 'T[0-9]{2}' | tr -d 'T' | tr '\n' ' ' - )" - tput rev; echo "$PLACE"; tput sgr0 - printtables - read -r + while true; do + LAT="$1" + LON="$2" + PLACE="$3" + downloadweatherxml "$LAT" "$LON" 2>/dev/null + TEMP="$(weatherdata "//temperature" "hourly")" + RAIN="$(weatherdata "//probability-of-precipitation" ".")" + WIND="$(weatherdata "//wind-speed" ".")" + #LOCATION="$(weatherdata "//location/description" ".")" + TIME="$( + weatherdata "//start-valid-time" "." | + grep -oE 'T[0-9]{2}' | tr -d 'T' | tr '\n' ' ' + )" + tput rev; echo "$PLACE"; tput sgr0 + printtables + read -r + done } weathermenu() {