Skip to content

Instantly share code, notes, and snippets.

@suzuki-shunsuke
Last active December 1, 2018 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suzuki-shunsuke/29ef246fd666cb89b2b78c1a73b01380 to your computer and use it in GitHub Desktop.
Save suzuki-shunsuke/29ef246fd666cb89b2b78c1a73b01380 to your computer and use it in GitHub Desktop.
shell script to check whether broken urls are included in files
# xurls: https://github.com/mvdan/xurls
s=0
for url in `find . -name "*" -type f | xargs xurls | grep -v "ldap.*"`; do
if ! `curl -LI $url -o /dev/null --fail -s`; then
echo $url
s=1
fi
done
if [ $s -ne 0 ]; then
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment