Created
August 27, 2019 16:22
-
-
Save freddiemixell/61a4ac0360edf7a8816b3cf05dd1d154 to your computer and use it in GitHub Desktop.
Check Redirects By CSV Output Pass/Fail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
check_redirects() { | |
while IFS=, read -r req dest; | |
do | |
test="$req => $dest" | |
echo "Now testing $test" | |
if curl -Is "$1"$req | grep -s $dest; then | |
result=Pass | |
else | |
result=Fail | |
fi | |
echo "$result: $test" >> results.log | |
sleep 1 | |
done < "$2" | |
} |
I don't have anything in place to fail if you don't pass the 2 params. Also, I don't have time to put those in place but if anyone wants to comment with error handling I'll update the Gist! 😄
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this to your
~/.bashrc
or in my case~/.zshrc
for checking a csv of redirects for any particular site.Run:
check_redirects https://example.com /path/to/redirects.csv