Skip to content

Instantly share code, notes, and snippets.



Last active Aug 27, 2019
What would you like to do?
CLI to evaluate the HTTP Code for a list of URLs
while IFS= read -r LINE || [ "$LINE" ]; do
IN=$(curl -o /dev/null --silent --head --write-out "%{http_code};%{redirect_url}" "$LINE")
arrIN=(${IN//;/ })
if [ "${arrIN[0]}" = "301" ] || [ "${arrIN[0]}" = "302" ]; then
printf "${arrIN[0]},$LINE,${arrIN[1]}\n"
printf "${arrIN[0]},$LINE\n"
done < "$1"

This comment has been minimized.

Copy link
Owner Author

@digitaljhelms digitaljhelms commented Jun 6, 2019

Usage: ./httpcode url-list.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment