Skip to content
Snippets Groups Projects
pathcheck.sh 596 B
Newer Older
  • Learn to ignore specific revisions
  • #!/bin/bash
    
    
    
    
    for file in $@; do
    
    check=$(cat $file | grep -Po "\[.*?\]\([^ ]*?\)" | grep -v "#" | grep -vE "http|@|www|ftp|none" | sed 's/\[.*\]//g' | sed 's/[()]//g' | sed 's/\/$/.md/g')
    
    if [ ! -z "$check" ]; then
    #	echo "\n+++++ $file +++++\n"
    
    wrong=0
    for line in $check; do
    #echo $line
    
    pathtocheck=$(dirname $file)/$line
    
    
    if [ -f $(dirname $file)/$line ]; then
    	:
    	#echo "ok $pathtocheck"
    else
    	if [ $wrong -eq "0" ]; then
    		echo ""
    		echo "\n+++++ $file +++++\n"
    	fi
    	wrong=1
    
    Pavel Gajdušek's avatar
    Pavel Gajdušek committed
    #	echo "wrong link in $(readlink -m $pathtocheck)"
    
    	echo "wrong link in $pathtocheck"