#!/bin/sh #Arguments: # 1 = Link to yahoo weather # 2 = output dir url=${1-"http://de.weather.yahoo.com/germany/berlin/berlin-638242/?unit=c"} out=${2-"/tmp"} # Getting all the necessary info. wget --user-agent="" -q -t 1 -T 10 -O "$out/ywtemp.htm" "$url" wget --user-agent="" -q -t 1 -T 10 -O "$out/ywtemp.png" `grep 'forecast-icon.*http.*png' $out/ywtemp.htm | grep -o http*[a-zA-Z0-9\\.\\-\\\\_/\\:]*.png | grep -m 1 http` | echo "Current: `grep 'forecast-icon.*http.*png' $out/ywtemp.htm | grep -o yw-temp..[-0-9]\\* | grep -o temp..[-0-9]* | grep -o [-0-9][-0-9]*`" || { exit 1; } echo "Conditions: `grep 'forecast-icon.*http.*png' $out/ywtemp.htm | grep -o 'yw-cond..[a-zA-Z ]*' | grep -o \[A-Z].*`" || { exit 1; } echo `grep 'forecast-icon.*http.*png' $out/ywtemp.htm | grep -o High[:].[-0-9][-0-9]*` || { exit 1; } echo `grep 'forecast-icon.*http.*png' $out/ywtemp.htm | grep -o Low[:].[-0-9][-0-9]*`|| { exit 1; } echo "Image: $out/ywtemp.png"