CUR_QTR=$(( ($(date +%-m)-1)/3+1 ))
PREV_QTR_START_DATE=""
PREV_QTR_END_DATE=""
+# email Bill Erickson and Sally Smith with quarterly bib export totals
+EMAIL_RECIP=bserickson@kcls.org,ssmith@kcls.org
function die { echo "$@" 1>&2 ; exit 1; } # thanks, internet.
# Put a file into the working directory with the export
# date so the importer can refer to it later.
echo "$(date +'%F')" > "$WORKING_DIR/EXPORT_DATE"
+
+ # count the number of MARC record separator characters
+ count=$(cat $EXPORT_FILE | perl -e '$/="\x1D";$c = 0;$c++ while (<>);print "$c";')
+ echo "" | mailx -s \
+ "Exported $count Bibs for Backstage Q$CUR_QTR $CUR_YEAR4" \
+ $EMAIL_RECIP
fi
else
die "No MARC export file was created at $EXPORT_FILE"