4

plain text weather on command line

view full story
linux-howto

http://crunchbanglinux.org – I found the idea of using an internet weather service to display weather information in a terminal here on the forum. The general idea is to use the "-dump" option of a terminal browser like elinks or lynx and parse its output.My current version uses "google.com/search?hl=en&q=weather+city" and looks like this:weather(){ elinks -dump "google.com/search?hl=en&q=weather+${1:-munich}" | \ sed -n '/Weather for/,${;s/^ *//;/iGoogle/d;s/-.*//;s/|.*//;p;/Humidity/q;}' | \ sed '2,$s/^/ /' }and the output:Weather for Munich, Germany (HowTos)