From e564f3a3886ef311ce71cbd7682199578a174ea3 Mon Sep 17 00:00:00 2001 From: Dan White Date: Thu, 15 Sep 2011 22:50:54 -0500 Subject: [PATCH] Get current METAR and/or TAF report --- metar.sh | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) 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>/ { print }' \
+        | sed -e 's/<[/]*\w\+>//g' -e 's/^ \+/  /g'
+fi
+
-- 
2.25.1