
ドメイン名のファイル (約 9000 個の URL) があります。すべての URL に対して curl リクエストを正常に実行するのにかかる時間を測定しようとしています。
#!/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
何らかの理由で、最初の URL を読み取った後にループが停止します。スクリプトを正しく実行するのを手伝ってくれる人はいますか。