yoshi445511
April 28th, 2010, 10:22 PM
I have a weather script that i need to pass an argument to, and then have curl fetch a URL with that argument variable in it. It doesn't give me any errors, but there is no output.
Here's the script
ZIPCODE=
while getopts "z" OPTION; do
case $OPTION in
z)
ZIPCODE=$OPTARG
;;
esac
done
curl --silent -o weather.html "http://www.wunderground.com/cgi-bin/findweather/getForecast?query="$ZIPCODE"&wuSelect=WEATHER"
grep '<span class="nobr"><span class="b">.*</span> °F</span>' weather.html | sed ' s@<span class="nobr"><span class="b">@@' | sed ' s@</span> °F</span>@@'
EDIT: Oh, Gosh. I seem to have mistakingly posted in the wrong section. Can an Admin Please close this?
Here's the script
ZIPCODE=
while getopts "z" OPTION; do
case $OPTION in
z)
ZIPCODE=$OPTARG
;;
esac
done
curl --silent -o weather.html "http://www.wunderground.com/cgi-bin/findweather/getForecast?query="$ZIPCODE"&wuSelect=WEATHER"
grep '<span class="nobr"><span class="b">.*</span> °F</span>' weather.html | sed ' s@<span class="nobr"><span class="b">@@' | sed ' s@</span> °F</span>@@'
EDIT: Oh, Gosh. I seem to have mistakingly posted in the wrong section. Can an Admin Please close this?