In trying to change the hostname in the bash prompt of a running system (without rebooting):
I tried changing the hostname of my system using the command
hostname NEW_HOST_NAME. For good measure, I also did
/etc/rc.d/hostname restartas suggested in the forums. Now when I issue the command
hostnameit shows me the NEW_HOST_NAME. But when I do
echo $HOSTNAMEit still shows the old hostname.
So when 1 didn't work, I edited the entry against hostname in
rc.confas suggested in mailing lists.
Changing the entry in
rc.conf does not change the output of
And when I do
echo $HOSTNAME it still shows the old hostname. And
hostname of course shows the new name.
So I am rather lost on what is going on behind the scenes here. Any clarification/explanation would be most appreciated. And more (or maybe less) importantly how I can change the hostname of the running system so that the bash prompt gets updated (I did try
source ~/.bashrc after changing things but that obviously doesn't work since
echo $HOSTNAME still outputs the old hostname).