Topic: Weather script (for use with Conky)
When I went to use the weather command in Conky, I was annoyed that the closest location I could use was Philadelphia (I live about 20-30 minutes west of there). Therefore, I decided to use AccuWeather's website to obtain the current temperature. I will probably modify the script to also give the forecast, but that's for later. As of now, the script stand like this:
#!/bin/bash
wget -q http://www.accuweather.com/us/pa/wayne/19087/city-weather-forecast.asp?unit=c
cat city-weather-forecast.asp?unit=c | grep '<div class="info"> <span class="cond">' > current.txt
cat current.txt | grep -o [0-9] > current2.txt
cat current2.txt | sed '/.*[^\.]$/N;s/\n *//'
rm city-weather-forecast.asp?unit=c
rm current.txt
rm curent2.txtThis script returns the weather in degrees celcius. To change it to fahrenheit, simply remove the ?unit=c in the first, second, and fifth lines. Save this script somewhere like your home directory or a scripts folder or something.
To use with Conky, place this line in your config file
Temperature: ${execi INTERVAL /path/to/above/script}CAnd that's it!
Feel free to leave feedback!
- Chaanakya
Join SpiderOak using this link and get an extra 1 GB free: https://spideroak.com/download/referral 660e787ff1