echo I just need to know a few things... read -p "This machine's name [$(hostname -s)]: " devsuffix [ x${devsuffix}x = xx ] && devsuffix=$(hostname -s) read -p "What email address should emails be redirected to? [devel]: " email [ x${email}x = xx ] && email=devel echo echo "Set hostname." echo "hostname=$devsuffix.internal" >> /etc/rc.conf hostname $devsuffix.internal echo "Reconfigure sendmail to deliver all mail to $email" # This is (very) evil.. but it works cd /etc/mail make >/dev/null # Add in 'redirect everything to $username@localhost mail spool... head -$(grep -n 'R\$@' $devsuffix.internal.cf | head -1 | cut -d\: -f1) $devsuffix.internal.cf > temp cat <>temp DR$email R$+ $: \$R # Redirect all mail to $email EOF tail -$(($(wc -l $devsuffix.internal.cf | awk '{print $1}')-$(grep -n 'R\$@' $devsuffix.internal.cf | head -1 | cut -d\: -f1))) $devsuffix.internal.cf >>temp mv temp $devsuffix.internal.cf # and again for .submit.cf... head -$(grep -n 'R\$@' $devsuffix.internal.submit.cf | head -1 | cut -d\: -f1) $devsuffix.internal.submit.cf > temp cat <>temp DR$email R$+ $: \$R # Redirect all mail to $email EOF tail -$(($(wc -l $devsuffix.internal.submit.cf | awk '{print $1}')-$(grep -n 'R\$@' $devsuffix.internal.submit.cf | head -1 | cut -d\: -f1))) $devsuffix.internal.submit.cf >>temp mv temp $devsuffix.internal.submit.cf make install >/dev/null make restart >/dev/null