Grab today's Astronomy Picture of the Day and set as background

Alec Jacobson

September 11, 2013

weblog/

I wrote this for my brother a while back. First set up your desktop to use some photo /path/to/today.jpg as a background.

Next save this in a file called apod.sh

#!/bin/bash
URL=`wget -q http://apod.nasa.gov/apod/ -O - | grep "<a href=.image" | sed -e 's/<a href=.\([^"]*\).*$/http:\/\/apod.nasa.gov\/apod\/\1/'`
wget -q "$URL" -O /path/to/today.jpg 

Note: be sure to change /path/to/today.jpg above.

Then set up a daily cronjob to execute this script:

@daily /path/to/apod.sh