我有一个域名文件(~9000 个网址)。我试图确定对所有 url 成功执行卷曲请求所需的时间。
#!/bin/bash
#read lines from file.
while read -r line || [[ -n "$line" ]]; do
#Start execution time.
start=`date +%s.%N`
curl -k -L $line
if (("$?" != "7")) || (("$?" != "6")) ||(("$?" != "35")) ; then
#If curl request is not one of these [error codes][1] then end execution time
end=`date +%s.%N`
fi
runtime=$( echo "$end - $start" | bc -l ) >> throughput.txt
#Can do an average on the file later.
done < urls.txt
由于某种原因,循环在读取第一个网址后停止。有人可以帮助我正确运行脚本吗?