Small changes to send-marks

This commit is contained in:
Philip Wadler 2020-01-05 22:36:10 +00:00
parent 98cb552b38
commit 784f99a406

View file

@ -6,7 +6,7 @@
# #
# This script assumes the following folder structure: # This script assumes the following folder structure:
# #
# $DIR/sXXXXXXX/cw$CW/$FILE # $DIR/sXXXXXXX/$CW/$FILE
# #
# The variable DIR refers to the directory passed in as an argument to the # The variable DIR refers to the directory passed in as an argument to the
# script. The variable XXXXXXX refers to the student ID, and it is assumed # script. The variable XXXXXXX refers to the student ID, and it is assumed
@ -14,9 +14,9 @@
# #
# sXXXXXXX@sms.ed.ac.uk # sXXXXXXX@sms.ed.ac.uk
# #
# is a valid email address. The variable $CW refers to the number for of the # is a valid email address. The variable $CW refers to the coursework
# coursework of which the students are meant to be notified. The directory # of which the students are meant to be notified (e.g., cw1). The directory
# DIR/sXXXXXXX/cwY/ should only contain a single file, which should be # DIR/sXXXXXXX/$CW/ should only contain a single file, which should be
# specified using the FILE parameter. # specified using the FILE parameter.
# #
# Usage: # Usage:
@ -32,12 +32,12 @@ shift
FILE="$1" FILE="$1"
shift shift
for ATTACHMENT in "${DIR%/}/s"*"/cw$CW/$FILE"; do for ATTACHMENT in "${DIR%/}/s"*"/$CW/$FILE"; do
SUBJ="Mark for coursework $CW" SUBJ="Mark for coursework $CW"
BODY="" BODY=""
SID=$(echo "$ATTACHMENT" | sed 's|.*/\(s[0-9]\{7\}\)/.*|\1|') SID=$(echo "$ATTACHMENT" | sed 's|.*/\(s[0-9]\{7\}\)/.*|\1|')
ADDR="$SID@sms.ed.ac.uk" ADDR="$SID@sms.ed.ac.uk"
CMD="echo \"$BODY\" | mail -s \"$SUBJ\" -a \"$ATTACHMENT\" \"$ADDR\"" CMD="echo \"$BODY\" | mail -c wadler@inf.ed.ac.uk -s \"$SUBJ\" -a \"$ATTACHMENT\" \"$ADDR\""
echo "You are about to run the following command:" echo "You are about to run the following command:"
echo -e "\n$CMD\n" echo -e "\n$CMD\n"
read -p "Are you sure? " -n 1 -r read -p "Are you sure? " -n 1 -r