cgal/Packages/Manual/scripts/ref_grep

40 lines
967 B
Bash
Executable File

#!/bin/sh
#
# Purpose: Used to check if the html files contain any unresolved references
# that appear in the form [ref:???]. This usually indicates that
# the label referred to at this point in the text was not defined.
#
# Usage: ref_grep [d1 d2 ...]
#
# If no argument is given, the default is to grep all html files
# in the current directory and all subdirectories. Otherwise,
# only the html files in subdirectories given as arguments are
# searched.
if [ $# -ne 0 ] ; then
CONTENTS="$*"
HTML_FILES=""
else
CONTENTS=`ls`
HTML_FILES=`ls *.html`
fi
if [ "$HTML_FILES" != "" ]; then
grep -n "ref:" $HTML_FILES
fi
for DIR in $CONTENTS; do
if [ -d $DIR ]; then
cd $DIR
echo "in directory $DIR"
HTML_FILES=`ls *.html`
if [ "$HTML_FILES" != "" ]; then
grep -n "ref:" $HTML_FILES
fi
echo "leaving directory $DIR"
cd ..
fi
done