Skip to content

Instantly share code, notes, and snippets.

@aozimkov
Created August 19, 2019 11:11
Show Gist options
  • Save aozimkov/280e5223809c39f32b9252928d7382f0 to your computer and use it in GitHub Desktop.
Save aozimkov/280e5223809c39f32b9252928d7382f0 to your computer and use it in GitHub Desktop.
Easy bash script check url status code from file
#!/bin/bash
checker(){
URL=$1
STATUS=`curl -s -o /dev/null -w "%{http_code}" $URL`
if [ $STATUS -eq 200 ]
then
echo "OK"
else
echo $URL
fi
}
while read URL; do checker "$URL"; done < $1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment