#!/bin/sh # submit code for a programming assignment ASSIGNMENT=prog1a HOME=/tmp export HOME PROGNAME=prog1 GRADER=baker@cs.fsu.edu HOSTNAME=`uname -a` SYSTEMS="Linux SunOS" OSNAME=`uname -s` PATH=/bin\:/usr/bin if [ ${OSNAME} = "Linux" ]; then MAIL=mail elif [ ${OSNAME} = "SunOS" ]; then MAIL=mailx else echo unrecognized OS; this script must run on Linux or SunOS exit -1; fi; for SYSTEM in ${SYSTEMS}; do if [ ! -x ${SYSTEM}/prog1 ]; then echo aborted: did not find file ${SYSTEM}/${PROGNAME} echo please check that you are in the correct working directory, echo and that you did compile and test your program with ${SYSTEM} exit -1; fi; done; for SUFFIX in .tar .tar.gz .uu; do if [ -f ${ASSIGNMENT}${SUFFIX} ]; then echo submit aborted: would overwrite file ${ASSIGNMENT}${SUFFIX} echo please rename ${ASSIGNMENT}${SUFFIX} or remove it, and then rerun this script exit -1; fi; done; for FILE in ${PROGNAME}.c; do if [ ! -f ${FILE} ]; then echo submit aborted: missing file ${FILE} echo please make sure you are in the directory that contains the files echo you want to submit, and then rerun this script exit -1; fi; done; tar cpf ${ASSIGNMENT}.tar ${PROGNAME}.c gzip ${ASSIGNMENT}.tar uuencode ${ASSIGNMENT}.tar.gz ${ASSIGNMENT}.tar.gz > ${ASSIGNMENT}.uu ${MAIL} -n -s "submission: ${ASSIGNMENT}" ${GRADER} < ${ASSIGNMENT}.uu for SUFFIX in .tar .tar.gz .uu; do rm -f ${ASSIGNMENT}${SUFFIX}; done; echo "sent file(s) [ ${PROGNAME}.c ] to ${GRADER}"