Last active
February 25, 2016 20:41
-
-
Save pbyrne/bd4e811123be0803f9e7 to your computer and use it in GitHub Desktop.
A recent gnarly bit of Bash I built up over a few minutes until it did what I needed. I was specifically looking to see which, if any, jobs posted to our job board weren't working, since someone reported that they'd clicked a link and it took them to a broken page, but neglected to tell me which posting it was.
This file contains hidden or 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
# oneliner | |
for link in $(curl https://dribbble.com/jobs.rss | grep link | cut -d'>' -f2 | cut -d'<' -f1); do echo $link; curl -I --location $link | grep -E '(Location|HTTP)' | cut -d' ' -f2; echo "--------------------"; done | |
# expanded | |
for link in $(curl https://dribbble.com/jobs.rss | grep link | cut -d'>' -f2 | cut -d'<' -f1); # cut the URL out of "<link>http://example.com</link>" from our jobs RSS feed | |
do echo $link # print it | |
curl -I --location $link | grep -E '(Location|HTTP)' | cut -d' ' -f2 # get the URL, follow any redirects, and print out each redirect and the ending HTTP status code | |
echo "--------------------" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🔥