使用shell编写判断URL是否成功登录的脚本

#!/bin/bashbash

dir="脚本的所在目录"
echo $dir
cd $dir
if [ $? == 0 ]
then pass
else
echo "wrong directory";exit 1
fi
[ -f $dir/ok.txt ] && echo > $dir/ok.txt
[ -f $dir/err.txt ] && echo > $dir/err.txt
while read url
do
wget --spider -q -o /dev/null --tries=1 -T 5 $url
if [ $? -eq 0 ]
then
echo $url >>$dir/ok.txt
action "$url is ok !" /bin/true
else
echo $url >>$dir/err.txt
action "$url is bad !" /bin/false
fi
done<$dir/urlide

相关文章
相关标签/搜索