#!/bin/bash
newname=$1
oldname=$(cat /etc/sysconfig/network | awk  -F  "="  '{print $2}'  | sed -n 2p)
echo | sed -i "s/${oldname}/${newname}/g"  /etc/hosts
echo | sed -i "s/${oldname}/${newname}/g"  /etc/sysconfig/network
