#!/bin/bash # simple weather conditions dump # go to http://mobile.srh.weather.gov/ to look up your location or # put your zip code here zipcode=75254 [[ "$1" == "-q" ]] && gui=yes # doing nearest location lookup by zipcode wget -qO /tmp/zp.html 'http://www.srh.noaa.gov/port/port_zc.php?Go2=Go&inputstring='$zipcode # Pick 2 of the 7 options current=`grep select=4 /tmp/zp.html| cut -d'"' -f2` forecast=`grep select=1 /tmp/zp.html| cut -d'"' -f2` # Get the weather wget -qO /tmp/current.html "http://www.srh.noaa.gov/port/$current" wget -qO /tmp/forecast.html "http://www.srh.noaa.gov/port/$forecast" lynx -dump /tmp/current.html |egrep -v '__|National|BUTTON|^ *$'| sed 's/ //' > /tmp/weather set -a `grep DAY /tmp/forecast.html|sed 's/[A-Z]*
//;s/<[^>]*>/ /g;s/°//g'` # formatting could be improved for opie-sh printf "\n $1\t\t $6\t ${11}\n" >> /tmp/weather printf "$2 $3\t $7 $8\t ${12} ${13}\n" >> /tmp/weather printf "$4 $5\t\t $9 ${10}\t ${14} ${15}\n" >> /tmp/weather # Display if [[ "$gui" == "yes" ]]; then opie-sh -g -f /tmp/weather -t Weather 2>/dev/null else cat /tmp/weather fi # leave /tmp/weather for future reference cd /tmp #rm zp.html current.html forecast.html