*** Fichier meteo.sh *** #!/bin/bash set -xv ######################################################################## # METEO # ######################################################################## ######################### # VARIABLES # ######################### VILLE=palaiseau LANG=fr ######################### # FONCTIONS # ######################### function get_meteo { curl "http://www.google.com/ig/api?weather=$VILLE&hl=$LANG" 2>/dev/null | iconv -f iso8859-1 -t utf-8 | xgrep -x $parse_xml | sed -f $HOME/scripts/meteo/weather.sed > .current_weather bash $HOME/.current_weather } #----------------------------------------------------------------------# ################################################## # PROGRAMME PRINCIPAL # ################################################## JOUR="today" case $JOUR in today) parse_xml="/xml_api_reply/weather/current_conditions" echo $parse_xml ;; esac get_meteo echo $condition exit *** Fichier weather.sed *** /<.*-->/d /current_conditions/d s/ data//g s/ //g s/ //g s/Humidité\;\ \:\ //g s/à/a/g *** Fichier .current_weather généré *** export condition="Ciel nuageux" export temp_f="30" export temp_c="-1" export humidity="80%" export icon="/ig/images/weather/cloudy.gif" export wind_condition="Vent : N a 10 km/h"