Skip to content

Instantly share code, notes, and snippets.

@omgmog
Created August 12, 2014 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save omgmog/d6d8c9eb909eb83af8b0 to your computer and use it in GitHub Desktop.
Save omgmog/d6d8c9eb909eb83af8b0 to your computer and use it in GitHub Desktop.
Check dead urls on https://github.com/tevko/Resources files
#!/bin/bash
# usage:
# cd Resources
# sh check_dead.sh
for file in *.md; do
echo "====== Reading file: ${file} ======"
while read line; do
url=$(echo "$line" | sed s/.*\(// | sed s/\)// | sed s/^##.*//)
if [[ ! -z "$url" ]]; then
echo "- Checking URL: ${url}"
curl -s --head "${url}" | head -n 1 | grep "HTTP/1.[01] [^23].."
fi
done <"$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment