• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3echo "Checking links in documentation..."
4
5# List of files in docs dir
6docs=$(find . -path './docs/*.md')
7# List of files in project root (README, etc)
8extras=$(find . -maxdepth 1 -name '*.md')
9# Combined list of files to check
10files=("${docs[@]}" "${extras[@]}")
11
12let "fails=0"
13let "count=0"
14
15for file in ${files[@]}; do
16    let "count++"
17    markdown-link-check -q "$file"
18    if [ $? -ne 0 ]; then
19        let "fails++"
20    fi
21done
22
23echo -e "\n\033[0;33m$count files checked."
24
25if [ $fails -gt 0 ]; then
26    echo -e "\033[0;31mERROR: $fails files with dead links found!"
27    exit 1
28else
29    echo -e "\033[0;32mCongratulations! No dead links found."
30    exit 0
31fi
32