viewtopic.php?t=1509&postdays=0&postorder=asc&start=0
为了符合自己的要求,修改了一下。(我是新手,请不要笑我)
我用这个配合firefox的xyzproxy扩展使用。(那个扩展可以从文本文件导入代理)
代码: 全选
#!/bin/bash
#Copyright (c) 2005 ubuntu.org.cn
#License: GPLv2
wget -O proxy.html -q http://info.hustonline.net/index/proxyshow.aspx
PROXYS=`cat proxy.html |grep '<b>' | nawk '{print $1}' | cut -c4- |cut -d\< -f 1 | sort`;
rm proxy.html
OLDPROXY=$http_proxy; # save the old proxy
WGET="wget --cache=off -q -T 35 -t 1 -w 0 -O /dev/null www.thecure.com";
# -q : quiet T=Timeout t=try w=wait second
for proxy in $PROXYS ; do
echo "Testing http://$proxy..."
export http_proxy="http://$proxy"
TEMPTIME=`/usr/bin/time -o proxy-timer.txt -f %e $WGET`;
if [ "$?" = 0 ] ; then
TEMPTIME=`cat proxy-timer.txt`;
echo -n $proxy >> proxy-test.txt
echo \#$TEMPTIME >> proxy-test.txt
fi
done
rm proxy-timer.txt
cat proxy-test.txt | sort -t# -n +1 > proxy-result.txt
# -t : define seprerator -n : sort as number +1 : sort field 1 (count from 0)
rm proxy-test.txt
export http_proxy=$OLDPROXY
exit 0