CURL=`which curl 2> /dev/null`
[ -z "$CURL" ] && (echo "Need to install the curl package."; exit 1)
## 读取镜像站点
mirrors=`curl --silent http://cygwin.com/mirrors.lst | cut -d';' -f1`
## 使用 CURL 依次检测时间
results=''
for mirror in $mirrors; do
echo -n "Checking ${mirror} ... "
time=`curl -m $timeout -s -o /dev/null -w %{time_total} $mirror`
if [ "$time" = "0.000" ]; then
echo -e "e[31mfaile[0m"
else
echo -e "e[32m$timee[0m"
results="${results}e[32m${time}e[0m - ${mirror}n"
fi
done
echo -e "n检测结果:"
echo -e $results | sort -n | sed '1d' | head -$mirrors_count
# vim: set expandtab tabstop=4 shiftwidth=4:










