Simple Weather Bash Script

This simple weather bash script was written with the intention of piping it to a text to speech program such as flite or festival. However, it can be used for any sort of text notification such as printing to the command line or emailing.

#!/bin/sh

# spkweather.sh
# Written by:
# Brandt Daniels
# December 2010

LAT=XX.XXXX
LON=-XXX.XXX

RAW=$(curl -s "http://forecast.weather.gov/MapClick.php?lat=$LAT&lon=$LON&TextType=1")
echo "$RAW" | sed 's/<b>\(.*\)<\/b>\(.*\)<br>.*/\1\2/;s/.*<.*//g;/^$/d' | head -$1
exit 0
Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s