LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Blogs > peonuser
User Name
Password

Notices



Rate this Entry

More weather getting scripts.

Posted 11-01-2011 at 11: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: 63F (17C)
Humidity: 87 %
Wind Speed: N 9 MPH
Barometer: 30.14 in. (1020.5 mb)
Dewpoint: 59F (15C)
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: 62F (17C)
Humidity: 58 %
Wind Speed: E 5 MPH
Barometer: 30.22 in. (1024.1 mb)
Dewpoint: 47F (8C)
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
Posted in Uncategorized
Views 248 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 01:39 PM.

Main Menu
Advertisement

Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration