#!/bin/sh set -e for mid in $(notmuch search --output=messages tag:inbox "$@"); do printf "%s ? " "$(notmuch show "$mid" | sed -n 's/Subject: //p')" read ans case "$ans" in y*) notmuch show --format=raw "$mid" | bogofilter -Sn notmuch tag -inbox -unread +spam -- "$mid" ;; esac done