#!/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