no, <title> stores date.
relevant parts of the xml look like this:
Code:
<title>October 5, 2013</title>
<fcttext>Chance of Rain. High 19°C (66°F). Winds 25 kph SW</fcttext>
the only thing that you can do is to print out the provided parameter or the default value hardcoded in the function, eg
Code:
weather()
{
(( $# )) || set -- "London,UK"
echo "Location: ${1//,/, }"
curl -s "http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?query=$1" | perl -ne 's/&deg;/°/g;
s/ \(\d+°F\)//g;
/<title>([^<]+)/ && printf "%s: ",$1;
/<fcttext>([^<]+)/ && print $1,"\n"';
}
(oneliners are overrated )
2nd line of the perl block strips Fahrenheits because we don't use them here. If you live in a Fahrenheit country, modify to strip °C with s/\d+°C \((\d+°F)\)/$1/g; but i don't think Sweden is one
Code:
$ weather
Location: London, UK
October 5, 2013: Chance of Rain. High 19°C. Winds 25 kph SW
October 6, 2013: Chance of Rain. High 19°C. Winds 10 kph WNW
October 7, 2013: Clear. High 20°C. Winds 10 kph WSW
October 8, 2013: Clear. High 20°C. Winds 10 kph SW
October 9, 2013: Clear. High 19°C. Winds 10 kph West
October 10, 2013: Scattered Clouds. High 19°C. Winds 10 kph NNE
$ weather Washington,DC
Location: Washington, DC
Today: Mostly sunny. Hot with highs in the upper 80s. Northwest winds around 5 mph.
Tonight: Mostly cloudy. Lows in the upper 60s. Southeast winds around 5 mph.
Sunday: Partly sunny. Hot with highs in the upper 80s. Southeast winds 5 to 10 mph.
Sunday Night: Partly cloudy in the evening...then becoming mostly cloudy. Lows in the mid 60s. South winds 5 to 10 mph.
Monday: Mostly cloudy. Showers...mainly in the afternoon. Highs in the upper 70s. South winds 10 to 15 mph. Chance of rain 80 percent.
Bookmarks