vmail-stack/etc/exim4/return-resender.sh

20 lines
429 B
Bash
Raw Normal View History

2021-03-19 14:26:15 -07:00
#!/bin/bash
HOSTNAME=$1
COUNT=`/bin/echo $HOSTNAME|/bin/grep -o '\.'|/usr/bin/wc -l`
if [ "$COUNT" -lt '2' ]; then
# second level domain, don't munge just return
/bin/echo -n $HOSTNAME
exit 0
elif [ "$COUNT" -ge '2' ]; then
# third or higher level domain, strip first level off
/bin/echo -n "$HOSTNAME" | /bin/sed 's/[^.]*./\*\./'
exit 0
else
# unexpected. hostname not set?
/bin/echo -n $HOSTNAME
exit 0
fi