Created
November 1, 2016 21:06
-
-
Save atomsfat/c82db0845194283aabf499add58eadd7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CURL_FORMAT="URL: %{url_effective} ReturnCode: %{http_code}, TTFB: %{time_starttransfer}, Total time: %{time_total}, Download Size: %{size_download}" | |
FILE_URL=$1 | |
TOTAL_URL=$(wc -l < $FILE_URL | xargs) | |
COUNTER=1 | |
echo "1..$TOTAL_URL" | |
while read LINE | |
do | |
RES=$(curl -L -s -o /dev/null -w "$CURL_FORMAT" $LINE) | |
STATUS=$(echo $RES| grep -o -E 'Code.*?,' | grep -o -E '\d{3}') | |
if [ "$STATUS" = "200" ] ; then | |
echo "ok $COUNTER - $RES" | |
else | |
echo "not ok $COUNTER - $RES" | |
fi | |
COUNTER=$((COUNTER+1)) | |
done < $FILE_URL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
File in contents must be an url by each line