ot: current weather conditions

Gene Collins collins at gene3.ait.iastate.edu
Wed Apr 18 10:04:56 EDT 2007


Hi all.  For those using linux who have an interest in seeing current
weather conditions, I've written a bash script that gets the weather
info from braille.wunderground.com, and displays the current conditions.

I called the script "conditions".  you just put it in a directory in
your tath, run chmod 755 on the file, and you are rready to go.  You
must have the lynx browser installed in order to use this.

You just type:

conditions Ames Iowa

or some other city state combination, or a zip code, and it displays the
current conditions for that location.  I've included the script at the
end of this message.  Have fun!

Gene Collins

#!/bin/bash
# conditions: a bash script to display current weather conditions.
# Author: Alvin Gene Collins
# Last modified: Wed Apr 18 09:03:34 CDT 2007.
# usage: conditions Ames Iowa
# or some other location or zip code.
#
if [ $# -eq 0 ];then export LOCATION="ames iowa";else export LOCATION="$*";fi
lynx "http://braille.wunderground.com/cgi-bin/findweather/getForecast?query=`echo $LOCATION`" -dump >/tmp/weather.tmp
grep -i "observed" /tmp/weather.tmp >/dev/null
if [ $? -gt 0 ];then echo $LOCATION not found\!;exit 1;fi
let A=`grep -i -n  "observed" /tmp/weather.tmp | cut -c 1-2`
declare -i A
A=A-1
tail -n +$A /tmp/weather.tmp | head -n +8
grep -i "sunrise" /tmp/weather.tmp
grep -i "sunset" /tmp/weather.tmp
grep -i "moon rise" /tmp/weather.tmp
grep -i "moon set" /tmp/weather.tmp
unset A
unset X
unset LOCATION






More information about the Speakup mailing list