#!/bin/sh grep -v HOSTNAME /etc/sysconfig/network > /root/temp ip4=`/sbin/ifconfig | awk '/inet / {if(match($2,"addr")) {print substr($2,6)} else {print $2}}' | head -1 |tail -1 | awk -F . {'print $4'}` hostname $1_$2_$3_$ip4 echo "HOSTNAME=`hostname`" >> /root/temp echo "127.0.0.1 `hostname`" >> /etc/hosts mv -f /root/temp /etc/sysconfig/network #cat > /etc/resolv.conf << EOF #nameserver 61.139.2.69 #nameserver 8.8.8.8 #EOF