#!/bin/bash USERNAME="$1" [ -z "$USERNAME" ] && echo "Usage : $0 [username]" && exit 1 echo "Search deferred mail from user $USERNAME ..." for ID in $( username_to_deferred_mailid "$USERNAME" ) do SENDER=$( mailq|egrep ^$ID|awk '{print $7}') [ -z "$SENDER" ] && SENDER="Unkown sender" while true do echo -n "$ID [$SENDER] : (c = cat mail / d = delete mail / K = keap mail / q = quit ) ? " read a case $a in c) postcat -q $ID|less ;; d) postsuper -d $ID break ;; k|"") break ;; q) exit 0 ;; *) echo "Bad choice !" esac done done