#! /bin/bash
todo=""
verb="--spam"
dest="spam"
for arg in "$@" ; do
case "$arg" in
-r) verb="--forget"
dest="new"
;;
*) todo="$todo $arg"
esac
done
if test -z "$todo" ; then
exit
fi
mail-scan +subject $todo
sa-learn $verb $todo
for file in $todo ; do
mv "$file" "$(dirname $file)/../$dest/"
done