summaryrefslogtreecommitdiff
path: root/user-mailaddr
diff options
context:
space:
mode:
Diffstat (limited to 'user-mailaddr')
-rwxr-xr-xuser-mailaddr18
1 files changed, 18 insertions, 0 deletions
diff --git a/user-mailaddr b/user-mailaddr
new file mode 100755
index 0000000..801d147
--- /dev/null
+++ b/user-mailaddr
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# /usr/local/sbin/localusermailaddr
+# Copyright 2002 Jonas Smedegaard <dr@jones.dk>
+#
+# $Id: user-mailaddr,v 1.1 2002-03-14 12:15:33 jonas Exp $
+#
+# List mail addresses attached to an account
+#
+
+for uid in $@; do
+ echo "$uid@`cat /etc/mailname`"
+ grep "[[:space:]]$uid\$" `ls /etc/postfix/virtual* | egrep -v '\.(bak|db|dpkg-new|dpkg-old|old)$'` | sed -e 's/.*://' -e 's/[[:space:]].*//' | sort
+ for otheruid in `grep "^[[:alnum:]-]\+:[[:space:]]\+$uid" /etc/aliases | sed 's/:.*//'`; do
+ echo "$otheruid@`cat /etc/mailname`"
+ grep "[[:space:]]$otheruid\$" `ls /etc/postfix/virtual* | egrep -v '\.(bak|db|dpkg-new|dpkg-old|old)$'` | sed -e 's/.*://' -e 's/[[:space:]].*//' | sort
+ done
+done