一个下载图片的小shell script

1356阅读 0评论2010-01-11 heut2009
分类:

#!/bin/bash
#a small colorful shell script for download pictures
#2010-1-11 made by yifan
temp=/var/temp
urlfile=/var/temp1
if [ !f /var/temp1 ]
then
touch /var/temp1
fi
echo -e "\33[32m"
echo "input a .html type url page which contains jpg"
echo -e "\33[30m"
read webpage
curl $webpage >$temp
sed -i 's/http:/\nhttp:/g;s/\.jpg/\.jpg\n/g' $temp
sed -n '/^http.*jpg$/p' $temp >$urlfile
echo -e "\33[34m"
echo -e "\tstarting to download pictures,please wait!"
for pic in `cat $urlfile`
do
wget $pic
done
echo -e "\tpictures have been put into $PWD"
echo -e "\33[30m"
rm -f $temp $urlfile
上一篇:策略路由
下一篇:深入理解静态路由