#! /bin/sh for f in *.pck do /var/lib/mailman/bin/show_qfiles $f| less while echo -n "$f (rm/a/m/?/*): "; read command do case "$command" in rm) rm $f && echo "file removed" break ;; m*) # mail to user, removing first line mail=`echo $command | sed 's/^m//'` /var/lib/mailman/bin/show_qfiles $f | sed '1d' | sendmail $mail ;; a) /var/lib/mailman/bin/show_qfiles $f| less ;; ?) cat <: send the file to ?: display this anything else: skip the file EOF ;; *) break ;; esac done done