I'm not that familiar with GNOME, but it sounds a little odd to me. However, your /etc/hosts is used to resolve that name
You can store IP-addresses in there, in case you can't use DNS instead.
Microsoft Windows even has a hosts file.. with unix-style comments
Maybe should just use the tool shipped with your distribution to change your hostname. (some distro's even offer a nice graphical configuration tool)
FYI: Here is how my distribution defines/sets the hostname:
* at boot, the command /bin/hostname `cat /etc/HOSTNAME`
is executed. In other words, the hostname is stored in /etc/HOSTNAME, and it's set by reading the contents, and using that as argument to /bin/hostname.
Every OS needs to read+set it's settings every time at boot. Linux is no exception, but gives you a little more insight in the details. (I'd assume Microsoft Windows does the same thing)
* To resolve my hostname, you need DNS. However "localhost", and your own name can't resolved by DNS... at least, definitely not at boot time. That's what we have the /etc/hosts file for.
* For network names, there is an /etc/networks file too.
* If your system resolves hostnames, it uses /etc/host.conf to determine the order. (look at hosts, or try DNS first)
About the prompt script: How did you try to run the script? It's supposed to work
..and what shell do you use? (most likely /bin/bash though) edit:
just forgot to mention, ~/.bashrc is executed only when bash starts.. To use the new prompt directly, type "source ~/.bashrc" to run bashrc. Don't forget the "source" command; it runs the commands directly in your own shell process.