Need to download images using range of dates or specified date from Nasa. The date keeps defaulting to current date although I input different date.
TODAY= read -p "Enter date: "$(+%Y-%m-%d)
if [ ! -e ~/Pictures/${TODAY}_apod.jpg ]; then echo "We don't have the picture saved, save it"
get_page
PICURL=`/bin/cat /tmp/pic_url`
echo "Picture URL is: ${PICURL}"
echo "Downloading image"
wget --quiet $PICURL -O $PICTURES_DIR/${TODAY}_apod.jpg
echo "Setting image as wallpaper"
gconftool-2 -t string -s /desktop/gnome/background/picture_filename $PICTURES_DIR/${TODAY}_apod.jpg
save_description
else get_page
PICURL=`/bin/cat /tmp/pic_url`
echo "Picture URL is: ${PICURL}"
SITEFILESIZE=$(wget --spider $PICURL 2>&1 | grep Length | awk '{print $2}')
FILEFILESIZE=$(stat -c %s $PICTURES_DIR/${TODAY}_apod.jpg)
if [ $SITEFILESIZE != $FILEFILESIZE ]; then
echo "The picture has been updated, getting updated copy"
rm $PICTURES_DIR/${TODAY}_apod.jpg
PICURL=`/bin/cat /tmp/pic_url`
echo "Downloading image"
wget --quiet $PICURL -O $PICTURES_DIR/${TODAY}_apod.jpg
echo "Setting image as wallpaper"
$PICTURES_DIR/${TODAY}_apod.jpg
save_description
else echo "Picture is the same, finishing up" fi It should download image from the date provided.