if [ ! -z $new_host_name ]; then hostname $new_host_name echo $new_host_name >/etc/hostname fi if [ ! -z $new_domain_name ]; then host_name=$(hostname) sed -i "s/\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*$host_name.*/\1 $host_name.${new_domain_name:-local} $host_name/" /etc/hosts fi