Check README in check_links.sh

The script now checks the README document for broken links.
This commit is contained in:
Markus Mäkelä 2018-07-07 09:27:00 +03:00
parent cb05199bac
commit a1b5852ad0
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -16,9 +16,8 @@
homedir=$(pwd)
find . -name '*.md'|while read file
do
cd "$(dirname "$file")"
function check_file() {
file=$1
grep -o '\[.*\]([^#].*[.]md)' "$(basename "$file")"| sed -e 's/\[.*\](\(.*\))/\1/'|while read i
do
if [ ! -f "$i" ]
@ -26,5 +25,15 @@ do
echo "Link $i in $file is not correct!"
fi
done
}
find . -name '*.md'|while read file
do
cd "$(dirname "$file")"
check_file $file
cd "$homedir"
done
cd ..
check_file $PWD/README.md
cd "$homedir"