Linux and Curl: How to use Bash to Read a File Line by Line and Execute Curl command to get HTTP Response Code

for URL in `cat crunchify.txt`; do echo $URL; curl -m 10 -s -I $1 "$URL" | grep HTTP/1.1 |  awk {'print $2'}; done

-m: Maximum time in seconds that you allow the whole operation to take. This is useful for preventing your batch jobs from hanging for hours due to any network issue

-s: show error message

-I: Show document info only

awk: matches the pattern and prints result

发表评论

电子邮件地址不会被公开。 必填项已用*标注