Sample Shell Script

#!/bin/bash
#
# This script is to train and test SimStudent with existing BRD files
#
# This script takes the command line arguments listed below:
#
# $1 : a list of BRD files or directories for training problems
# $2 : a list of BRD fiels or directories for test problems
# $3 : a name of a directory where log files will be stored
# $4 : max num of training problems
# $5 : max num of test problems
#
# Both Max num of training and test problems might be useful
# when you have too many BRDs in a target directory.
#
#
# (c) 2008, Noboru Matsuda (mazda@cs.cmu.edu)
# Carnegie Mellon University

#
# Set LIBDIR the directory name where you have DorminWidgets.jar
#
LIBDIR="${HOME}/Project/CTAT/SimSt/lib"

#
# Set TUTOR the class name of the Student Interface for your CTAT tutor
#
TUTOR="SimStAlgebraI/ThreeStepEq"

#
# Command line arguments
#
TRAININGS=$1
TESTS=$2
LOGDIR=$3
NUMTRAINING=$4
NUMTEST=$5

#
# Securing the LogDir
#
if [ ! -e ${LOGDIR} ]; then
mkdir ${LOGDIR}
fi

FOILDIR="${LOGDIR}/foil-data"
if [ ! -e ${FOILDIR} ]; then
mkdir ${FOILDIR}
fi

PRDIR="${LOGDIR}/pr-age"
if [ ! -e ${PRDIR} ]; then
mkdir ${PRDIR}
fi

#
# A log file for the rest results
#
TESTLOG="${LOGDIR}/test-log.txt"
if [ -e ${TESTLOG} ]; then
rm $TESTLOG
fi
#
# A log file for shell std output
#
SHLOG="${LOGDIR}/sh-log.txt"

#
# CTAT options
#
TutorArg="-ssBatchMode"
TutorArg="${TutorArg} -traceLevel '-1'"
TutorArg="${TutorArg} -debugCodes miss"
TutorArg="${TutorArg} -ssSearchTimeOutDuration 60000"
TutorArg="${TutorArg} -ssProblemSet $TRAININGS"
TutorArg="${TutorArg} -ssTestSet $TESTS"
TutorArg="${TutorArg} -ssFoilLogDir ${FOILDIR} -ssPrAgeDir ${PRDIR}"
TutorArg="${TutorArg} -ssTestOutput $TESTLOG"
TutorArg="${TutorArg} -ssSetMaxNumTraining $NUMTRAINING"
TutorArg="${TutorArg} -ssSetMaxNumTest $NUMTEST"

#
# VM options
#
if [ "${OS}" = "Windows_NT" ]; then
CPS=";"
fi
if [ "${OS}" != "Windows_NT" ]; then
CPS=":"
fi

DorminJar="${LIBDIR}/DorminWidgets.jar"
CPATH="${DorminJar}${CPS}..${CPS}."
VmOption="-cp ${CPATH} -Xmx1024m"

echo java ${VmOption} ${TUTOR} ${TutorArg}
java ${VmOption} ${TUTOR} ${TutorArg} >& ${SHLOG}


Last Updated January 24, 2010
Comments