#!/bin/sh # Bourne shell script to display grades of a student in a course # Assumes existence of an ASCII file grades.out # Bill Bynum # August 1998 sysbin=/usr/localbin:/usr/local/gnu/bin:/bin:/usr/bin:/usr/lib otherbin=$HOME/bin:/home/mom4/bynum/bin PATH=$sysbin:$otherbin:. case $GRADEFILE in "") fname=grades.sc.asc ;; *) fname=$GRADEFILE;; esac pgmname=`basename $0` usage() { echo "$pgmname \"student name fragment\"" echo " Any line of the grade file $fname matching the student name fragment," echo " along with the best possible and class average information," echo " is written to stdout. The name of the grade file can be changed" echo " to your preference by setting the environment variable GRADEFILE" } case $1 in "") echo The name of the person owning the grades is required! usage exit;; esac if (test -f $fname) then echo Showing grades of $1 echo "" date echo "" head -4 $fname grep "$1" $fname grep "[Cc]lass [Aa]verages" $fname else echo The ASCII file of grades \"$fname\" does not exist. usage fi # # $Log: showgrades,v $ # Revision 1.4 1999/07/30 19:31:41 bynum # put /home/mom4/bynum/bin last in otherbin variable # # Revision 1.3 1999/07/30 16:02:26 bynum # add PATH # # Revision 1.2 1999/07/30 10:48:52 bynum # add GRADEFILE variable # # Revision 1.1 1998/08/19 11:11:10 bynum # Initial revision # #