Course Management Scripts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
643 B

#!/bin/bash
[ -z "$COURSE" ] && echo "Needs a COURSE set" && exit 1
BUF=""
I=0
if [ "$1" = "1" ]; then
SHORT=y
fi
while read USER; do
if [ -z $SHORT ]; then
echo -n "$USER: "
fi
if [ -L /course/$COURSE/assn/$USER ] ; then
if [ -z $SHORT ] ; then
echo -e "\x1b[31;1mskipping link /course/$COURSE/assn/$USER\x1b[0m"
fi
continue
fi
I=$((I + 1))
TMP=`find /course/$COURSE/assn/$USER/ -maxdepth 1 -mindepth 1 -type d -printf '%f\n'`
if [ -z $SHORT ]; then
echo `wc -l <<< "$TMP"` "assns"
fi
BUF="$BUF
$TMP"
done
if [ -z $SHORT ]; then
echo "$I users processed"
sort <<< "$BUF" | uniq -c
else
sort <<< "$BUF" | uniq
fi