Skip to content
Permalink
Browse files

Check dead links

  • Loading branch information...
richelbilderbeek committed Jun 10, 2019
1 parent 4ffa93f commit caa3345c396891dece90ed93c370d358924ab557
Showing with 18 additions and 0 deletions.
  1. +18 −0 scripts/check_dead_links
@@ -0,0 +1,18 @@
#!/bin/bash

# Collect all dead links in a file
find . -name \*.md -exec markdown-link-check {} \; 2>/dev/null | egrep "[✖]" > broken.txt

# Count the number of lines, extract only that number
n_broken=$(wc broken.txt --lines | cut -f 1 -d " ")

if [[ $n_broken > 0 ]]
then
echo "Number of broken files: "$n_broken
cat broken.txt
rm broken.txt
exit $n_broken
fi

rm broken.txt

0 comments on commit caa3345

Please sign in to comment.
You can’t perform that action at this time.