Created
September 19, 2014 20:07
-
-
Save teopost/e6998b529c692ceb6269 to your computer and use it in GitHub Desktop.
Nasa image day
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -x | |
#cambia lo sfondo del desktop | |
#mettendo l'immagine del giorno prelevata dal sito della nasa | |
#change wallpaper with nasa image day | |
DIR=$HOME/Immagini/WALL | |
if [ ! -d "$HOME/Immagini" ]; then | |
mkdir "$HOME/Immagini" | |
if [ ! -d "$DIR" ]; then | |
mkdir "$DIR" | |
fi | |
fi | |
NAME=`wget http://www.nasa.gov/rss/lg_image_of_the_day.rss -O - | grep -o 'http://www.nasa.gov/images/[^<]*' | head -n1 | awk -F / '{print $NF}'` | |
ls "$DIR" | grep "$NAME" 2> /dev/null | |
if [ "$?" = "0" ]; then | |
exit 0 | |
else | |
wget $(wget http://www.nasa.gov/rss/lg_image_of_the_day.rss -O - | grep -o 'http://www.nasa.gov/images/[^<]*' | head -n1) -O "$DIR/$NAME" | |
#gconftool-2 -t string -s /desktop/gnome/background/picture_filename "$DIR/$NAME" | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment