X-Git-Url: https://git.madduck.net/etc/mailfilter.git/blobdiff_plain/b950ed9b38f03bb658650d6e6e52a122ab5c1fc8..58b867358a2222a9aa847bc4db05472082b8c8bf:/bin/resubmit diff --git a/bin/resubmit b/bin/resubmit index 8405e77..17888f9 100755 --- a/bin/resubmit +++ b/bin/resubmit @@ -2,11 +2,16 @@ set -eu PROCMAIL=$HOME/.etc/mailfilter/procmail/procmailrc +FORMAIL="/usr/bin/formail -I'X-Resubmitted: $(date -R)'" if [ -z "${1:-}" ]; then - cat | exec $PROCMAIL + eval $FORMAIL | exec $PROCMAIL else - $PROCMAIL < "$1" && rm -f "$1" + if [ ! -f "$1" ]; then + echo "E: no such file: $1" >&2 + exit 1 + fi + eval $FORMAIL < "$1" | $PROCMAIL && rm -f "$1" fi exit 0