set -e
function usage () {
- echo "gma.sh [--body] [--keepspam] [--subject|--from|--to|--fromto|--sender] <pattern> [<year>]"
+ echo "gma.sh [--body] [--nospam] [--subject|--from|--to|--fromto|--sender] <pattern> [<year>]"
}
RESULT_MBOX="/tmp/gma"
+KEEP_SPAM=1
if [[ -z "${MAIL_ARCHIVE_DIR}" ]]; then
echo "Undefined \$MAIL_ARCHIVE_DIR" >&2
IONICE=""
;;
- "--keepspam")
- KEEP_SPAM=1
+ "--nospam")
+ KEEP_SPAM=0
;;
"--from")
echo " in ${FILE_PATTERN}"
echo " writing result in ${RESULT_MBOX}"
-if [[ ${KEEP_SPAM} ]]; then
+if [[ ${KEEP_SPAM} == "1" ]]; then
${IONICE} cat ${FILE_PATTERN} \
| pv -s ${SIZE} -p -t -e - \