More weather getting scripts.
Posted 11-01-2011 at 10:24 AM by peonuser
Same script two ways.
$ ./gwp7.sh Polk FL
National Weather Service
__________________________________________________ ________________
Polk , FL
Current Local Conditions at:
Gilbert Field
Lat: 28.05 N Lon: 81.75 W Elev: 144 ft
Last Update: 11/01/11, 08:53 AM EDT
Weather: Fair
Temperature: 63°F (17°C)
Humidity: 87 %
Wind Speed: N 9 MPH
Barometer: 30.14 in. (1020.5 mb)
Dewpoint: 59°F (15°C)
Visibility: 10.00 mi.
__________________________________________________ ________________
Weather printout
Enter the State: LA
County: Cameron
-------------------------------------------------
National Weather Service
__________________________________________________________________
Cameron , LA
Current Local Conditions at:
Lake Charles Regional Airport
Lat: 30.12 N Lon: 93.22 W Elev: 15 ft
Last Update: 11/01/11, 09:53 AM CDT
Weather: Fair
Temperature: 62°F (17°C)
Humidity: 58 %
Wind Speed: E 5 MPH
Barometer: 30.22 in. (1024.1 mb)
Dewpoint: 47°F (8°C)
Visibility: 10.00 mi.
__________________________________________________________________
$ ./gwp7.sh Polk FL
National Weather Service
__________________________________________________ ________________
Polk , FL
Current Local Conditions at:
Gilbert Field
Lat: 28.05 N Lon: 81.75 W Elev: 144 ft
Last Update: 11/01/11, 08:53 AM EDT
Weather: Fair
Temperature: 63°F (17°C)
Humidity: 87 %
Wind Speed: N 9 MPH
Barometer: 30.14 in. (1020.5 mb)
Dewpoint: 59°F (15°C)
Visibility: 10.00 mi.
__________________________________________________ ________________
Code:
if [ $# -lt 2 ] ; then echo "You wrote: $0 $*" echo "Please use the format: $0 County ST" exit fi state=$2 county=$1 county="$county " statecode="$stateZ" echo lynx -dump http://alerts.weather.gov/cap/$state.php?x=2 | grep "$county" > x grep -e "$statecode" x > y grep -e $county y > z thecode=$(tail -1 z | sed 's/^.*\(......\)$/\1/') lynx -dump "http://mobile.weather.gov/port_mp_ns.php?select=3&CityName=$county&site=BOX&State=$state&warnzone=$thecode" # # Voice playback # lynx -dump "http://mobile.weather.gov/port_mp_ns.php?select=3&CityName=$county&site=BOX&State=$state&warnzone=$thecode" | festival --tts
Weather printout
Enter the State: LA
County: Cameron
-------------------------------------------------
National Weather Service
__________________________________________________________________
Cameron , LA
Current Local Conditions at:
Lake Charles Regional Airport
Lat: 30.12 N Lon: 93.22 W Elev: 15 ft
Last Update: 11/01/11, 09:53 AM CDT
Weather: Fair
Temperature: 62°F (17°C)
Humidity: 58 %
Wind Speed: E 5 MPH
Barometer: 30.22 in. (1024.1 mb)
Dewpoint: 47°F (8°C)
Visibility: 10.00 mi.
__________________________________________________________________
Code:
clear echo echo " Weather printout" echo read -p "Enter the State: " state read -p " County: " county echo "-------------------------------------------------" echo # state=TX # county=Galveston county="$county " statecode="$stateZ" lynx -dump http://alerts.weather.gov/cap/$state.php?x=2 | grep "$county" > x grep -e "$statecode" x > y grep -e $county y > z thecode=$(tail -1 z | sed 's/^.*\(......\)$/\1/') lynx -dump "http://mobile.weather.gov/port_mp_ns.php?select=3&CityName=$county&site=BOX&State=$state&warnzone=$thecode" # lynx -dump "http://mobile.weather.gov/port_mp_ns.php?select=3&CityName=$county&site=BOX&State=$state&warnzone=$thecode" | festival --tts
Total Comments 0