#! /bin/sh set -euf if ! notmuch search tag:killed | grep -q . ; then echo 'no killed mail; abort.' exit 1 fi notmuch search tag:killed printf 'want do rm these mail? [y/N] ' read REPLY case "$REPLY" in y|Y) :;; # continue *) echo 'abort.' exit 2 ;; esac notmuch search --output=files tag:killed | xargs -l rm -v notmuch new