#!/bin/sh

echo "Test script for assignment 3 submission."
echo "Notify hayest@cs if this script does not work correctly."
#echo "Still in testing; more functionality coming later."
echo
WHOIAM=`whoami`
echo 'You should have copied a file named '$WHOIAM'.tar into the handin directory.'
echo

if [ 1=1 ] 
    then
        echo 'Creating and moving to /tmp/'$WHOIAM'1234'
        mkdir '/tmp/'$WHOIAM'1234'
        cd '/tmp/'$WHOIAM'1234'
        echo 'Making copy of your submission.'
        cp '/stage/classes/current/cspp535/handin/'$WHOIAM'.tar' .
        echo '$ tar -xvf '$WHOIAM'.tar'
        tar -xvf $WHOIAM'.tar'
        echo 'cd assign3'
        cd assign3
        echo 'rm -rf *.class'
        rm -rf *.class
        echo 'make all'
        make all
        echo 'java Calculator'
        echo 'Check to make sure your app works the way it should'
        java Calculator 
        cd
        echo 'Deleting temporary files.'
        rm -rf '/tmp/'$WHOIAM'1234'
    else
        echo 'For now, please go to this URL for handin testing instructions.'
        echo 'http://mailman.cs.uchicago.edu/pipermail/cspp535/2001-July/000034.html'   
        echo
        echo 'If your first handin worked, you are probably fine this time too.'
fi
