カールコマンド実行時間

カールコマンド実行時間

ドメイン名ファイル(〜9000 URL)があります。すべての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

何らかの理由で最初のURLを読んだ後、ループは停止します。誰もがスクリプトを正しく実行するのに役立ちますか?

ベストアンサー1

おすすめ記事