--- psiconv/trunk/formats/index_html.sh 2004/04/29 19:40:59 249 +++ psiconv/trunk/formats/index_html.sh 2004/04/29 21:43:28 250 @@ -6,17 +6,16 @@ targets_file="$1" shift files="$@" - echo -n "" > "$targets_file" + printf "" > "$targets_file" for file in $files; do ( line_nr=1 while read line; do error=0 - while [ $error -eq 0 ] && echo $line | grep -q '\[' ; do - if echo $line | grep -q '\[.*\]'; then -# The use of ! is not portable. - echo -n "$file $line_nr " >> "$targets_file" + while [ $error -eq 0 ] && echo $line | grep '\[' >/dev/null ; do + if echo $line | grep '\[.*\]' >/dev/null; then + printf "%s %s " "$file" "$line_nr" >> "$targets_file" echo $line | sed -e 's,^[^\[]*\[,,' -e 's,\].*$,,' \ >> "$targets_file" else @@ -25,11 +24,11 @@ fi line=`echo $line | sed -e 's,^[^]]*\],,'` done - if [ $error -eq 0 ] && echo $line | grep -q '\]' ; then + if [ $error -eq 0 ] && echo $line | grep '\]' >/dev/null ; then echo "In \`$file\' line $line_nr: target brackets inbalance" >&2 error=1 fi - line_nr=$[$line_nr+1] + line_nr=`echo "$line_nr + 1" | bc` done ) < $file done