#!/bin/bash # weather--Gets the weather for a specific region or ZIP code. if [ $# -ne 1 ]; then echo "Usage: $0 " exit 1 fi apikey="b0304b43b2e7cd23" # Not a real API key--you need your own. weather=`curl -s \ "https://api.wunderground.com/api/$apikey/conditions/q/$1.xml"` state=`xmllint --xpath \ //response/current_observation/display_location/full/text\(\) \ <(echo $weather)` zip=`xmllint --xpath \ //response/current_observation/display_location/zip/text\(\) \ <(echo $weather)` current=`xmllint --xpath \ //response/current_observation/temp_f/text\(\) \ <(echo $weather)` condition=`xmllint --xpath \ //response/current_observation/weather/text\(\) \ <(echo $weather)` echo $state" ("$zip") : Current temp "$current"F and "$condition" outside."