每次开机自动下载bing的背景
发表于 : 2009-07-02 15:16
只要将下面的代码设为开机后延迟十分钟就行了,,---延迟是因为刚开机,可能网络没有连上去..
at now + 10 minutes <<< '/home/jj/bin/autorun/bing'
加到 /etc/rc.local 里就好了,,,
很久没写代码,就这么几行的代码花了我好长的时间啊,,,
生疏了
bing的背景很好看,,,先保存起来,说不定以后有用
at now + 10 minutes <<< '/home/jj/bin/autorun/bing'
加到 /etc/rc.local 里就好了,,,
很久没写代码,就这么几行的代码花了我好长的时间啊,,,
生疏了
代码: 全选
#!/bin/bash
set -x
DOWN_DIR=~/Pictures/bing # 下载图片的目录
DOWN_URL[0]="http://www.bing.com/?scope=web&setmkt=en-US&setlang=SET_NULL&uid=BB796A79&FORM=W5WA"
DOWN_URL[1]="http://cn.bing.com/?scope=web&mkt=zh-CN&FORM=W0LH"
# cd 到下载图片的目录去
cd $DOWN_DIR
for i in ${DOWN_URL[*]}
do
rm -f /tmp/bing
wget -O /tmp/bing $i
jpg_url=$(cat /tmp/bing | grep -oi 'g_img={url:.*jpg' | grep -o '/.*jpg' | sed -e 's/\\//g')
down_jpg_url=http://www.bing.com$jpg_url
wget -nc $down_jpg_url
done
# cd 回到原来的目录
cd -
bing的背景很好看,,,先保存起来,说不定以后有用