1 #!/bin/sh - 2 # This script runs the .ed scripts generated by mkscripts.sh 3 # and compares their output against the .r files, which contain 4 # the correct output 5 6 PATH="/bin:/usr/bin:/usr/local/bin/:." 7 [ X"$ED" = X ] && ED="../ed" 8 9 # Run the *-err.ed scripts first, since these don't generate output; 10 # rename then to *-err.ed~; they exit with non-zero status 11 for i in *-err.ed; do 12 echo $i~ 13 if $i; then 14 echo "*** The script $i~ exited abnormally ***" 15 fi 16 mv $i $i~ 17 done >errs.o 2>&1 18 19 # Run the remainding scripts; they exit with zero status 20 for i in *.ed; do 21 base=`echo $i | sed 's/\..*//'` 22 # base=`$ED - \!"echo \\\\$i" <<-EOF 23 # s/\..* 24 # EOF` 25 if $base.ed; then 26 if cmp -s $base.o $base.r; then :; else 27 echo "*** Output $base.o of script $i is incorrect ***" 28 fi 29 else 30 echo "*** The script $i exited abnormally ***" 31 fi 32 done >scripts.o 2>&1 33 34 grep -h '\*\*\*' errs.o scripts.o 35