X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=gma.sh;h=d914893960534fbae5ebe290dca5e70dcf4d4ee2;hb=0c7aaabde9bf206dd017f468bf5af86e2efb22dd;hp=e266737f0ea54e14e61bcf592bd057c1b912059e;hpb=ffe6c2b94c700aa9105a6c1b6a0b86853d74cd88;p=scripts.git diff --git a/gma.sh b/gma.sh index e266737..d914893 100755 --- a/gma.sh +++ b/gma.sh @@ -20,10 +20,11 @@ set -e function usage () { - echo "gma.sh [--body] [--keepspam] [--subject|--from|--to|--fromto] []" + echo "gma.sh [--body] [--nospam] [--subject|--from|--to|--fromto|--sender] []" } RESULT_MBOX="/tmp/gma" +KEEP_SPAM=1 if [[ -z "${MAIL_ARCHIVE_DIR}" ]]; then echo "Undefined \$MAIL_ARCHIVE_DIR" >&2 @@ -55,8 +56,8 @@ while [[ $1 ]]; do IONICE="" ;; - "--keepspam") - KEEP_SPAM=1 + "--nospam") + KEEP_SPAM=0 ;; "--from") @@ -71,6 +72,10 @@ while [[ $1 ]]; do RE_PREFIX="^(From|To):.*" ;; + "--sender") + RE_PREFIX="^Sender:.*" + ;; + "--subject") RE_PREFIX="^Subject:.*" ;; @@ -109,7 +114,7 @@ echo "Looking for ${RE_PREFIX}${PATTERN}" 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 - \