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

#!/bin/bash

dir="脚本的所在目录"echo $dircd $dirif [ $? == 0 ]then passelseecho "wrong directory";exit 1fi[ -f $dir/ok.txt ] && echo > $dir/ok.txt[ -f $dir/err.txt ] && echo > $dir/err.txtwhile read urldowget --spider -q -o /dev/null --tries=1 -T 5 $urlif [ $? -eq 0 ]thenecho $url >>$dir/ok.txt action "$url is ok !" /bin/trueelseecho $url >>$dir/err.txtaction "$url is bad !" /bin/falsefidone<$dir/url

点赞

发表评论

电子邮件地址不会被公开。必填项已用 * 标注