Skip to content

Instantly share code, notes, and snippets.

@willtonkin
Last active December 16, 2015 16:29
Show Gist options
  • Save willtonkin/5463572 to your computer and use it in GitHub Desktop.
Save willtonkin/5463572 to your computer and use it in GitHub Desktop.
Iterate through a list of URLs returning their HTTP response and showing their resultant redirect location. Been used for redirect testing.
#!/bin/bash
#BASE=example.com
while read LINE; do
echo -n "$BASE$LINE"
curl -o /dev/null --silent --head --write-out ' : %{http_code} -> ' "$BASE$LINE"
curl -IL -o /dev/null --silent --head --write-out '%{url_effective} : %{http_code}\n' "$BASE$LINE"
done < url-list.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment