summaryrefslogtreecommitdiff
path: root/user-mailaddr
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2006-05-05 10:24:56 +0000
committerJonas Smedegaard <dr@jones.dk>2006-05-05 10:24:56 +0000
commit9435de0bc22ed786f09becfbbfd496878a0fcee7 (patch)
tree5c6dfbe2455231633d3d4ee243004bb8d1b48929 /user-mailaddr
parentec73726086efa2b1a15df36d9869eb5d4b33357e (diff)
Incluce only /etc/postfix/virtual* without dot in filename (also simplifying code).
Diffstat (limited to 'user-mailaddr')
-rwxr-xr-xuser-mailaddr9
1 files changed, 5 insertions, 4 deletions
diff --git a/user-mailaddr b/user-mailaddr
index c583f44..ffddf2e 100755
--- a/user-mailaddr
+++ b/user-mailaddr
@@ -1,18 +1,19 @@
#!/bin/sh
#
# /usr/local/sbin/localusermailaddr
-# Copyright 2002 Jonas Smedegaard <dr@jones.dk>
+# Copyright 2002 - 2005 Jonas Smedegaard <dr@jones.dk>
#
-# $Id: user-mailaddr,v 1.2 2005-02-08 10:50:49 jonas Exp $
+# $Id: user-mailaddr,v 1.3 2006-05-05 10:24:56 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:]].*//' | grep -v '^$' | sort
+# grep "[[:space:]]$uid\$" | sed -e 's/.*://' -e 's/[[:space:]].*//' | grep -v '^$' | sort
+ find /etc/postfix -regex '.*/virtual[^.]*' -exec grep "[[:space:]]$uid\$" '{}' ';' | sed -e 's/.*://' -e 's/[[:space:]].*//' | grep -v '^$' | 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:]].*//' | grep -v '^$' | sort
+ find /etc/postfix -regex '.*/virtual[^.]*' -exec grep "[[:space:]]$otheruid\$" '{}' ';' | sed -e 's/.*://' -e 's/[[:space:]].*//' | grep -v '^$' | sort
done
done