Skip to content

Instantly share code, notes, and snippets.

@iitenkida7
Created July 26, 2017 16:14
Show Gist options
  • Save iitenkida7/76bbcef71277dc28067fa4e9e099afa6 to your computer and use it in GitHub Desktop.
Save iitenkida7/76bbcef71277dc28067fa4e9e099afa6 to your computer and use it in GitHub Desktop.
#!/bin/bash
#概要:URLリストを渡し、「200 OK」 ステータスのものだけ表示する。
#実行:check_url_200ok @file_name@
#OUT :200 OK URL一覧
function check_url_200ok (){
for URL in $(cat $1) ; do
RESULT_CODE=$(curl -LI ${URL} -o /dev/null -s -w '%{http_code}\n' -s)
if [ "_${RESULT_CODE}" == "_200" ] ; then
echo "${URL}"
fi
done
return 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment