#!/bin/bash # # GOOGLE FORECAST # if [ -z "$*" ]; then echo "google report via secret API" read managua echo else managua="$*" fi filetmp='/tmp/weather.tmp' #wget "http://www.google.com/ig/api?weather=$paese,italy&hl=it" 2>/dev/null -O -| tr '>' '\n' | tr '/' ' ' | tr '"' ' ' | tr '<' ' ' >$filetmp curl -s "http://www.google.com/ig/api?weather=$managua" | tr '>' '\n' | tr '/' ' ' | tr '"' ' ' | tr '<' ' ' > $filetmp cat << _EOF_ $(cat $filetmp | grep 'postal_code data' | cut -d'=' -f2 | tr [a-z] [A-Z]) on $(cat $filetmp | grep forecast_date | cut -d'=' -f2) Vis. $(cat $filetmp | head -n 14 | tail -n 1 | cut -d'=' -f2) Temp $(cat $filetmp | grep temp_c | cut -d'=' -f2 ) C Humd $(cat $filetmp | grep humidity | cut -d':' -f2) Wind $(cat $filetmp | grep wind_condition | cut -d':' -f2) _EOF_