批量检测URL的可达性

225 阅读1分钟
#!/bin/bash

while read -r url; do
  http_code=$(curl -sL -w "%{http_code}" "$url" -o /dev/null)
  if [ "$http_code" != "200" ]; then
    echo "$http_code $url"
  fi
done <<EOF
http://example.com/
https://itcool.fun/
http://bixuebihui.com/
https://qsn.so/
http://www.google.com/
https://qsn.so/index.php?user-app-login
http://以及其他的你要检查的.url/
EOF

引用:

批量探测URL的可达性