From: Dan White <dan@whiteaudio.com> Date: Fri, 16 Sep 2011 03:50:54 +0000 (-0500) Subject: Get current METAR and/or TAF report X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=e564f3a3886ef311ce71cbd7682199578a174ea3;p=pubbin.git Get current METAR and/or TAF report --- diff --git a/metar.sh b/metar.sh index f027381..bd142bc 100755 --- a/metar.sh +++ b/metar.sh @@ -1,7 +1,31 @@ #!/bin/bash + +METAR=1 +TAF=1 +if [ "$1" == "-m" ]; then + METAR=1 + TAF=0 + shift +elif [ "$1" == "-t" ]; then + METAR=0 + TAF=1 + shift +fi + STATION=$1 -wget -q -O - http://weather.noaa.gov/mgetmetar.php?cccc=$STATION \ - | grep -i $STATION \ - | tail -1 +if [ $METAR -eq 1 ]; then + # METAR + wget -q -O - http://weather.noaa.gov/mgetmetar.php?cccc=$STATION \ + | grep -i $STATION \ + | tail -1 +fi + +if [ $TAF -eq 1 ]; then + # TAF + wget -q -O - http://weather.noaa.gov/cgi-bin/mgettaf.pl?cccc=$STATION \ + | awk '/<pre>/, /<\/pre>/ { print }' \ + | sed -e 's/<[/]*\w\+>//g' -e 's/^ \+/ /g' +fi +