Know your weather from terminal

Here is a small trick i tired to find the weather from the terminal.
The simple code below , gives you the update of current weather in Bangalore.
You may change it to your place by changing the feed as per requirement.

Follow these steps :

$ sudo vi ~/.bashrc
Add this at the last :
alias tmp="curl -s --connect-timeout 30 "" | grep "Temperature" | sed -e 's/&#xB0;/ deg /g' | sed -e 's/&#37;/%/g'| sed 's/<[^>]*>//g'"
Save and close the file .
Now , 
source ~/.bashrc
$ tmp 
Temperature: 22 deg C (72 deg F), Wind Direction: W, Wind Speed: 11mph, Relative Humidity: 86%, Pressure: N/A, no change, Visibility: Good

Indeed it's a pleasant weather here in Bangalore (India) today :)

Share this