Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- YOUR_API_KEY=CHANGEME
- YOUR_CITY_ID=CHANGEME
- temps=`date +%s`;
- data=`wget -q -O - "http://api.openweathermap.org/data/2.5/weather?id=${YOUR_CITY_ID}&appid=${YOUR_API_KEY}&lang=fr&units=metric&lol=$temps" --delete-after`
- temperature=`echo ${data} | sed -n 's#.*{"temp":\(.*\),"pressure".*#\1#p'`
- temperaturetext=`echo ${data} | sed -n 's#.*"description":"\(.*\)","icon":.*#\1#p'`
- if [[ ${temperature} =~ "." ]]; then
- temperature=`expr $(echo "$temperature" |cut -f1 -d\.) + 1`;
- fi
- echo "$temperature" > /dev/shm/weathertemp.txt;
- echo "$temperaturetext" > /dev/shm/weathertemptext.txt;
- #weather files are now in /dev/shm/ for your conky. ;)
- #thanks @nazgullien !
Advertisement
Add Comment
Please, Sign In to add comment