Created
August 12, 2014 15:31
-
-
Save omgmog/d6d8c9eb909eb83af8b0 to your computer and use it in GitHub Desktop.
Check dead urls on https://github.com/tevko/Resources files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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