dank@sda.UUCP (Daniel P. Kionka) (06/20/89)
This is a useful utility for sites that have very hierarchial mail aliases. To find out who is included in an alias, run this script with the alias name as a parameter. (Multiple alias names will produce strange results.) In some companies, you can even use the output as a simple organizational chart. ------------------------------------------------------------------------ #! /bin/sh # rec-al -- recursive aliases # --------------------------- # # Usage: rec-al alias-name # # This program recursively expands mail aliases with "ypmatch". If your # aliases are not maintained by yellow pages or you do not have the ypmatch # utility, this program is worthless. # # This program runs very slowly, so it is probably best used to create # a file that you use later. The output is ideal for greps or further # shell script processing. # # It runs slowly because it uses recursive shell scripts and (if I # understand YP) lots of network calls. A much faster version could be # written with "ypcat -k aliases" and perhaps awk, if someone wants a # challenge. # # Written by Daniel P. Kionka, released to the public domain. # Verify parameters if [ $# -lt 1 ] then echo Usage: $0 alias fi name=$1 # to reverse the order, remove the shift and make parents="$*" shift parents="$* $name" list=`ypmatch $name aliases 2> /dev/null` if [ $? -eq 0 ] then list=`echo $list | sed 's/,//g'` for n in $list do # Recursive call ... $0 $n $parents done else # To print the leaves only, use "echo $name" echo $parents fi -- Daniel P. Kionka Cadence Design Systems, Inc. dank@sda.UUCP San Jose, CA 95134
dupuy@cs.columbia.edu (Alexander Dupuy) (06/21/89)
Here's a small script I use to do recursive alias expansion - it even knows about .forward files and works even without Yellow Pages support: verify.sh _______________________________________________________________________________ #!/bin/sh /usr/lib/sendmail -bv -v "${@?Usage: verify address ...}" _______________________________________________________________________________ @alex -- -- inet: dupuy@cs.columbia.edu uucp: ...!rutgers!cs.columbia.edu!dupuy