#!/bin/bash FILE=$HOME/mail/spam-tolearn PROG=/usr/bin/sa-learn if [ ! -s ${FILE} ] ; then echo "No box to learn from, or box is empty" exit 0 else if [ -f "${FILE}.process" ] ; then echo "In process, or ${FILE}.process needs to be removed" exit 1 fi echo "Processing ${FILE}" mv ${FILE} ${FILE}.process; touch ${FILE} ${PROG} --spam --mbox ${FILE}.process rm ${FILE}.process exit 0 fi