#!/bin/sh # # Remove addresses from a mailing list. # - Cameron Simpson 12apr2000 # : ${TMPDIR:=/tmp} [ $# -lt 2 ] && { echo "Usage: $0 list addresses..." >&2; exit 2; } list=$1; shift [ -s "$list" ] || { echo "$0: $list: no such list!" >&2; exit 1; } tmp=$TMPDIR/bounce.$$ xit=0 for addr do if grep "$addr" <"$list" >$tmp then if [ `wc -l <$tmp` -gt 1 ] then echo "multiple hits for $addr:" >&2 sed 's/^/ /' $tmp xit=1 else if cat $tmp >>"$list.bounces" then bsed "/$addr/d" "$list" || xit=1 else echo "$0: can't append $tmp to $list" >&2 xit=1 fi fi else echo "address $addr not in $list" >&2 xit=1 fi done rm -f $tmp exit $xit