#!/bin/sh # Bourne shell script to send grades to one student # Bill Bynum # August 1998 sysbin=/usr/local/bin:/usr/local/gnu/bin:/bin:/usr/bin:/usr/lib otherbin=$HOME/bin:/home/f85/bynum/bin PATH=$sysbin:$otherbin:. pgmname=`basename $0` gradescript=allgrade usage() { echo "Usage: $pgmname [options] \"fragment of a student's name\"" echo " sends grade mail to one student by grep-ing for the name" echo " fragment in the gradescript file $gradescript, then" echo " executing the matching line. The grep will find the" echo " FIRST occurrence of the name fragment" echo "Options:" echo " -d debug, don't actually send the grade mail" echo " -s scriptname use 'scriptname' instead of $gradescript" echo " -m msgfname insert 'msgfname' into the grade message" } while true do case $1 in "-d") debug=$1 shift;; "-s") if (test ! -f $2) then echo "Grade script file \"$2\" does not exist!" usage exit fi gradescript="$2" shift shift;; "-m") if (test ! -f $2) then echo "Message file \"$2\" does not exist!" usage exit fi msgflag="-m $2" shift shift;; *) break;; esac done case $1 in "") echo "Person's name is required!" usage exit;; esac eval `grep classtitle $gradescript | head -1` echo "classtitle $classtitle" cmd=`grep $1 $gradescript` case $cmd in "") echo "String \"$1\" was not in $gradescript" usage exit;; esac eval $cmd # # $Log: sendgrades,v $ # Revision 1.6 2005/09/19 14:33:22 bynum # change mom4 to f85 # # Revision 1.5 1999/07/30 19:30:40 bynum # put /home/mom4/bynum/bin last in otherbin variable # # Revision 1.4 1999/07/30 19:28:14 bynum # fix /usr/local/bin in sysbin variable # # Revision 1.3 1999/07/30 15:48:59 bynum # add PATH # # Revision 1.2 1999/07/30 10:42:59 bynum # send grades to one student by extracting the appropriate line from # the 'allgrade' script # #