summaryrefslogtreecommitdiffstats
path: root/mailq-recipient
diff options
context:
space:
mode:
Diffstat (limited to 'mailq-recipient')
-rwxr-xr-xmailq-recipient12
1 files changed, 12 insertions, 0 deletions
diff --git a/mailq-recipient b/mailq-recipient
new file mode 100755
index 0000000..91dc13e
--- /dev/null
+++ b/mailq-recipient
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+if [[ -z $1 ]]; then
+ echo "Usage: ${0##*/} <recipient>"
+ exit
+fi
+
+mailq | tail -n +2 | grep -v '^ *(' | awk 'BEGIN { RS = "" }
+ # $7=sender, $8=recipient1, $9=recipient2
+ { if ($8 == "'$1'" && $9 == "")
+ print $1 }
+ ' | tr -d '*!'