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


