2016-09-09 14:39:47 -04:00
|
|
|
[ -f functions.sh ] && source functions.sh
|
|
|
|
|
2017-04-03 17:59:44 -04:00
|
|
|
set -f
|
2016-09-09 14:39:47 -04:00
|
|
|
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 '<tr><td>Temperature</td>' | tr -cd '[:digit:]-.')"
|
|
|
|
weatherConditions="$(echo "$weatherInfo" | grep -A 1 '<tr><td>Conditions</td>' | tail -n1 | sed 's/<[^>]*>//g')"
|
2017-04-03 17:59:44 -04:00
|
|
|
weatherConditions="${weatherConditions/*Rain/wetter than a teenage girl at a boy band concert}"
|
2016-09-09 14:39:47 -04:00
|
|
|
weatherInfo="Currently your weather is $weatherConditions and $weatherTemperature degrees fahrenheit."
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ${#weatherInfo} -lt 5 ]; then
|
|
|
|
weatherInfo="Sorry $1, no weather found for $3."
|
|
|
|
fi
|
2016-09-09 14:42:18 -04:00
|
|
|
msg "$2" "$1: $weatherInfo"
|
2017-04-03 17:59:44 -04:00
|
|
|
set +f
|