Hemanth's Scribes

web

Know Your Weather From Terminal

Author Photo

Hemanth HM

Thumbnail

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 “http://newsrss.bbc.co.uk/weather/forecast/1193/ObservationsRSS.xml” | grep “Temperature” | sed -e ‘s/°/ deg /g’ | sed -e ‘s/%/%/g’| sed ‘s/<[>]*>//g’”

Save and close the file .

Now , source ~/.bashrc Then, $ 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 :)

#javascript#linux
Author Photo

About Hemanth HM

Hemanth HM is a Sr. Machine Learning Manager at PayPal, Google Developer Expert, TC39 delegate, FOSS advocate, and community leader with a passion for programming, AI, and open-source contributions.