1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/bin/bash if [ -d "${1}" ]; then MAILS="`ls ${1}`" if [ ! -z "${MAILS}" ]; then for MAIL in ${MAILS} do echo "Report ${1}/${MAIL}" spamassassin -r < "${1}/${MAIL}" echo "Delete ${1}/${MAIL}" rm "${1}/${MAIL}" done fi if [ -z "${MAILS}" ]; then echo "Nothing in ${1} to report!" fi fi