Skip to content

Instantly share code, notes, and snippets.

@morimori
Created May 30, 2014 07:28
Show Gist options
  • Save morimori/4d128eee4612b688b2fa to your computer and use it in GitHub Desktop.
Save morimori/4d128eee4612b688b2fa to your computer and use it in GitHub Desktop.
ファイルに書かれた URL をチェックして、cURL の exit コードと HTTP ステータスコードを表示する
#! /bin/sh
echo "curl exit code\thttp status code\turl"
while read url ; do
http_status=$(curl -L -f -s -A 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0' "${url}" -o /dev/null -w '%{http_code}\n')
echo "${?}\t${http_status}\t${url}"
sleep 1
done < $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment