Skip to content

Instantly share code, notes, and snippets.

@Blake-
Created March 16, 2023 15:41
Show Gist options
  • Save Blake-/319d57679db39618a49decf322415ba4 to your computer and use it in GitHub Desktop.
Save Blake-/319d57679db39618a49decf322415ba4 to your computer and use it in GitHub Desktop.
Shell script that returns http code from a list of sites
#!/bin/bash
INPUT=sites.txt
OLDIFS=$IFS
IFS=,
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read SITE
do
curl -o /dev/null --silent --head --write-out '%{url_effective},%{http_code}\n' $SITE
sleep 1
done < $INPUT
IFS=$OLDIFS
echo -e "Done :-)\n\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment