Skip to content

Instantly share code, notes, and snippets.

@tevko
Forked from omgmog/check_dead.sh
Last active August 29, 2015 14:06
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 tevko/fdc5cd88f5d1344b2252 to your computer and use it in GitHub Desktop.
Save tevko/fdc5cd88f5d1344b2252 to your computer and use it in GitHub Desktop.
#!/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