需要使用日期范围或指定的日期从美国航空航天局下载图像。尽管我输入了其他日期,该日期仍默认为当前日期。
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
其他 回声“图片是一样的,整理” 科幻 它应该从提供的日期开始下载图像。