#/bin/bash
email="your_email_address"; #change this
record_file="/tmp/submissions"; #change this
submission_directory="/tmp/"; # change this for each coursework
filename=$1; # the first argument to the script
current_path=$(pwd); # store current location
student_username=$(whoami);
date_string=$(date +%b.%d.%k.%M.%N);
unique_string=$date_string.$student_username;
cd $submission_directory;
if test -d $student_username ; then
$(cp $current_path/$filename $student_username/$unique_string);
echo "Submitting additional file";
echo $unique_string >> $record_file; #append string to record of
#submissions
else
echo "Creating directory for first submission";
$(mkdir $student_username);
echo "Making first submission";
$(cp $current_path/$filename $student_username/$unique_string);
echo $unique_string >> $record_file; #append string to record of
#submissions
fi
number_submissions=$(ls -1 $student_username | wc -l);
echo "You have now submitted $number_submissions attempts.";
echo "If this seems wrong to you please email $email.";
#!/bin/bash
tar czf - $* | uuencode homework.tgz | mail -s "`whoami`homework" event@somerandomschool.edu
posted by b1tr0t at 12:51 PM on May 18, 2006