bash: get http response codes for a list of URLs
Posted: August 24, 2011 | Author: Hilary Mason | Filed under: blog | Tags: bash, code, script, shell | 14 Comments »I had a file with a list of URLs, and I wanted to grab the HTTP response codes for each of them. I’m sure this quick bash script isn’t the best way to do it, but it works, and I’ll probably want to do this again someday, so here it is!
#!/bin/bash
while read line
do
echo $(curl --write-out %{http_code} --silent --output /dev/null $line)
done <$1
-
http://xn.pinkhamster.net/ Christian G. Warden
-
http://calliopesounds.blogspot.com/ Andrew Gilmartin
-
http://www.hilarymason.com Hilary Mason
-
-
http://twitter.com/brocknoland brocknoland
-
http://twitter.com/_vkris Vivek Krishna
-
http://kenegozi.com/blog Ken Egozi
-
http://twitter.com/teepark teepark
-
http://mendicantbug.com Jason A
-
http://www.hilarymason.com Hilary Mason
-
-
-
-
E A
-
Guest
-
-
http://www.facebook.com/profile.php?id=42410031 Giti Shorish
-
Mcgowan
-
http://twitter.com/Mandragola69 Mandragola


