From ba62a946b12a7f0ca1341ec03d7aed4b7a07e9f9 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Mon, 3 Apr 2017 17:59:44 -0400 Subject: [PATCH] Fixed small error with rain in weather functions. --- modules/weather/weather.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/weather/weather.sh b/modules/weather/weather.sh index fc028a9..997ce9b 100755 --- a/modules/weather/weather.sh +++ b/modules/weather/weather.sh @@ -1,10 +1,11 @@ [ -f functions.sh ] && source functions.sh +set -f if [ ${#3} -ge 5 ]; then weatherInfo="$(curl -s "http://mobile.wunderground.com/cgi-bin/findweather/getForecast?brand=mobile&query=$3")" weatherTemperature="$(echo "$weatherInfo" | grep -A 2 'Temperature' | tr -cd '[:digit:]-.')" weatherConditions="$(echo "$weatherInfo" | grep -A 1 'Conditions' | tail -n1 | sed 's/<[^>]*>//g')" -weatherConditions="${weatherConditions/Rain/wetter than a teenage girl at a boy band concert}" +weatherConditions="${weatherConditions/*Rain/wetter than a teenage girl at a boy band concert}" weatherInfo="Currently your weather is $weatherConditions and $weatherTemperature degrees fahrenheit." fi @@ -12,3 +13,4 @@ if [ ${#weatherInfo} -lt 5 ]; then weatherInfo="Sorry $1, no weather found for $3." fi msg "$2" "$1: $weatherInfo" +set +f