by tangke 2009-09-09
今天在测试豹哥的LFS的时候对于里面用到大量包下载的问题,写了一个脚本。
#!/bin/bash
rm -rf download_list
rm -rf successful_list
rm -rf unsuccessful_list
sed -n -e '/http:\/\/.*/p' -e '/ftp:\/\/.*/p' download_list_tmp> download_list
sed -i 's/ //g' download_list
all=`cat download_list`
for a in ${all}
do
filename=`echo "${a}" | sed -e 's/.*\///g' `
if test -e ${filename}
then
case $1 in
"down")
echo "the ${filename} file exists..";;
"list")
# echo "download file save in successful_list"
echo "${a}" >> successful_list;;
*) echo "Sorry, you must input a parameters";;
esac
else
case $1 in
"down")
echo "start to download the file ${filename}"
wget ${a};;
"list")
# echo "undownload file save in unsuccessful_list"
echo "${a}" >>unsuccessful_list;;
*) echo "Sorry, you must input a parameters";;
esac
fi
done
#!/bin/bash
#delete the all directory
all=`ls`
for directory in ${all}
do
if test -d ${directory}
then
rm ${directory} -rf
fi
done
file=`ls *.bz2 *.gz`
for a in ${file}
do
echo "tar xf ${a} -C ./"
tar xf ${a} -C ./
done
阅读(269) | 评论(0) | 转发(0) |