Xref: utzoo alt.sources:2592 comp.mail.misc:4325 Path: utzoo!utgpu!cs.utexas.edu!helios!bcm!rice!uw-beaver!mit-eddie!wuarchive!zaphod.mps.ohio-state.edu!think.com!yale!ox.com!lokkur!scs From: scs@lokkur.dexter.mi.us (Steve Simmons) Newsgroups: alt.sources,comp.mail.misc Subject: Alias Lister For Users Summary: It's about time... Message-ID: <1990Nov17.023351.16824@lokkur.dexter.mi.us> Date: 17 Nov 90 02:33:51 GMT Organization: Inland Sea Lines: 86 At work we live and die by email, and we've got mail aliases coming out our ears. I get regular requests to know who's on a given alias. Our user community is pretty computer-naive, so telling them to grep the alias file isn't real useful. In a flash of inspiration, I threw together the following shell script. Install it as 'printalias' (or the name of your choice) on a sendmail-based system, and it'll give you nice listings of who is in any given alias. It's slow, but what the hell. Check the values of ALIASES and SENDMAIL to be sure they're right for your installation. Enjoy. #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'printalias' <<'END_OF_FILE' X: X# Script to tear apart a sendmail alias and list the recipients. X# Written by Steve Simmons at home. Public domain. X# X# $RCSfile: printalias,v $ $Revision: 1.1 $ X# X# $Author: scs $ $Date: 90/11/16 17:03:06 $ X# X# $State: Exp $ $Locker: $ X# X# $Log: printalias,v $ X# Revision 1.1 90/11/16 17:03:06 scs X# Initial revision X# X# XSCRIPT=`basename $0` XTEMP=/tmp/$$.${SCRIPT} XALIASES=/usr/lib/aliases XSENDMAIL=/usr/lib/sendmail Xif [ ! -r $ALIASES ] ; then X echo "${SCRIPT}: Sorry, I cannot find the aliases list ($ALIASES)." X exit 1 Xfi Xif [ ! -r $SENDMAIL ] ; then X echo "${SCRIPT}: Sorry, I cannot find the alias processor ($SENDMAIL)." X exit 1 Xfi Xtrap "rm -f $TEMP ; exit" 0 1 2 Xfor ALIAS in $* Xdo X if grep "^$ALIAS:" $ALIASES 1>/dev/null 2>&1 ; then X $SENDMAIL -bv $ALIAS > $TEMP X echo "The \`$ALIAS' alias will send to:" X exec < $TEMP X while read NAME1 TRASH X do X read NAME2 TRASH X read NAME3 TRASH X read NAME4 TRASH X read NAME5 TRASH X read NAME6 TRASH X echo " " $NAME1 $NAME2 $NAME3 $NAME4 $NAME5 $NAME6 X done | sed -e 's/\.\.\.//g' X else X echo "There is no such alias as \`$ALIAS'." X fi Xdone END_OF_FILE if test 1117 -ne `wc -c <'printalias'`; then echo shar: \"'printalias'\" unpacked with wrong size! fi chmod +x 'printalias' # end of 'printalias' fi echo shar: End of shell archive. exit 0 -- "When your neighbour loses his job, it's a slowdown; when you lose your own job, it's a recession; when an economist loses his job it's a depression." -- "Six Ways To Define A Recession", The Economist, Nov. 3 1990.