Check README in check_links.sh
The script now checks the README document for broken links.
This commit is contained in:
@ -16,9 +16,8 @@
|
|||||||
|
|
||||||
homedir=$(pwd)
|
homedir=$(pwd)
|
||||||
|
|
||||||
find . -name '*.md'|while read file
|
function check_file() {
|
||||||
do
|
file=$1
|
||||||
cd "$(dirname "$file")"
|
|
||||||
grep -o '\[.*\]([^#].*[.]md)' "$(basename "$file")"| sed -e 's/\[.*\](\(.*\))/\1/'|while read i
|
grep -o '\[.*\]([^#].*[.]md)' "$(basename "$file")"| sed -e 's/\[.*\](\(.*\))/\1/'|while read i
|
||||||
do
|
do
|
||||||
if [ ! -f "$i" ]
|
if [ ! -f "$i" ]
|
||||||
@ -26,5 +25,15 @@ do
|
|||||||
echo "Link $i in $file is not correct!"
|
echo "Link $i in $file is not correct!"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
find . -name '*.md'|while read file
|
||||||
|
do
|
||||||
|
cd "$(dirname "$file")"
|
||||||
|
check_file $file
|
||||||
cd "$homedir"
|
cd "$homedir"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
check_file $PWD/README.md
|
||||||
|
cd "$homedir"
|
||||||
|
|||||||
Reference in New Issue
Block a user