#! /bin/csh
echo "Erasing old .class files"
echo "   /bin/rm -f test[0-9].class"
/bin/rm -f test[0-9].class

/bin/rm -f results.jc
echo "Compiling with jc ... (It will not take long. jc is blazingly fast)"
echo Note: test1.java has two intentional errors
foreach i (test0 test1 test2 test3 test4 test5 test6 test7 test8 test9) 
  echo "  " jc $i.java
  jc $i.java > /dev/null
end 
echo "Now running them ..."
echo > results.jc
foreach i (test0 test1 test2 test3 test4 test5 test6 test7 test8 test9) 
  echo "  " java $i \>\> results.jc
  echo "-- " $i " --" >> results.jc
  java $i >> results.jc
end;

echo "Compiling with javac ... (Be patient. javac is very slow)"
echo Note: test1.java has two intentional errors 
foreach i (test0 test1 test2 test3 test4 test5 test6 test7 test8 test9) 
  echo "  " javac $i.java
  javac $i.java 
end 
/bin/rm -f results.javac
echo > results.javac
foreach i (test0 test1 test2 test3 test4 test5 test6 test7 test8 test9) 
  echo "  " java $i \>\> results.javac
  echo "-- " $i " --" >> results.javac
  java $i >> results.javac
end;

echo diff results.jc results.javac 
diff results.jc results.javac 

