home *** CD-ROM | disk | FTP | other *** search
- :
- # Script to tear apart a sendmail alias and list the recipients.
- # Written by Steve Simmons at home. Public domain.
- #
- # $RCSfile: printalias,v $ $Revision: 1.1 $
- #
- # $Author: scs $ $Date: 90/11/16 17:03:06 $
- #
- # $State: Exp $ $Locker: $
- #
- # $Log: printalias,v $
- # Revision 1.1 90/11/16 17:03:06 scs
- # Initial revision
- #
- #
- SCRIPT=`basename $0`
- TEMP=/tmp/$$.${SCRIPT}
- ALIASES=/usr/lib/aliases
- SENDMAIL=/usr/lib/sendmail
- if [ ! -r $ALIASES ] ; then
- echo "${SCRIPT}: Sorry, I cannot find the aliases list ($ALIASES)."
- exit 1
- fi
- if [ ! -r $SENDMAIL ] ; then
- echo "${SCRIPT}: Sorry, I cannot find the alias processor ($SENDMAIL)."
- exit 1
- fi
- trap "rm -f $TEMP ; exit" 0 1 2
- for ALIAS in $*
- do
- if grep "^$ALIAS:" $ALIASES 1>/dev/null 2>&1 ; then
- $SENDMAIL -bv $ALIAS > $TEMP
- echo "The \`$ALIAS' alias will send to:"
- exec < $TEMP
- while read NAME1 TRASH
- do
- read NAME2 TRASH
- read NAME3 TRASH
- read NAME4 TRASH
- read NAME5 TRASH
- read NAME6 TRASH
- echo " " $NAME1 $NAME2 $NAME3 $NAME4 $NAME5 $NAME6
- done | sed -e 's/\.\.\.//g'
- else
- echo "There is no such alias as \`$ALIAS'."
- fi
- done
-