Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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
@atomsfat

This comment has been minimized.

Copy link
Owner Author

commented Nov 1, 2016

./url_checker.sh some file

File in contents must be an url by each line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.