Only for FreeBSD of course. This automatically adds the host name and IP address of the primary interface to the '/etc/hosts' file
IP_ADDRESS=$(ifconfig $(netstat -4rn | grep ^default | sed "s/.* //") inet | awk '$1 == "inet" {print $2}')
HOSTNAME=$(hostname)
if ! grep -q $HOSTNAME /etc/hosts; then
printf "%s\t\t%s\n" $IP_ADDRESS $HOSTNAME >> /etc/hosts
fi