Fotos: 2009/07/20


Latest Post
Monday, July 06, 2009

Fotos: 2009/07/06


Fotos: 2009/07/06
Wednesday, July 01, 2009

Weather reporting script


Weather reporting script

UPDATE: I have just been noticed that curl is not included in some distros like ubuntu, so, remember to check if your curl package is installed. (Thanks Crespo !)

UPDATE2: Corrected a problem with comma sign on floating numbers for locales different that US. (Thanks Crespo ! -again-)

This script works on any *nix system that has bash, curl, grep cat and sed (almost any). Just provide it with your current weather.com city code as a parameter or modify the code to set the code variable to your city code.
Run example:

bash weather GMXX0185 will retrieve the weather from Frankfurt. The script will show current forecast and next hours temperatures and precipitation percentile:


To find your city code, go to weather.com, lookup your city and when you see the results grab the following part of the URL:



Download: here.

To run, once downloaded you can run it with bash:
bash weather YOURCODE
Or give it run permissions (chmod +x weather) and run it:
./weather YOURCODE

Enjoy !

Blogger templates

A cœur vaillant rien d'impossible.
Powered by Blogger.

Labels

About