Hi there:
One more thing. The script works fine now, but I discovered something which want you to know.
Here is the script gain:
#!/bin/sh
#original script EOT changed to EOF
NEWNAME="box2"
echo $NEWNAME > /etc/hostname
hostname -F /etc/hostname
cat > /etc/hosts << EOF
127.0.0.1 $NEWNAME localhost
EOF
This script writes: 127.0.0.1 box2 localhost into /etc/hosts this way all modifications of the file hosts are lost after reboot. So if you use this script and have your other hosts (fixed IP) listed you must include the hosts into the script above.
example:
#!/bin/sh
#original script EOT changed to EOF
NEWNAME="box2"
echo $NEWNAME > /etc/hostname
hostname -F /etc/hostname
cat > /etc/hosts << EOF
127.0.0.1 $NEWNAME localhost
192.168.1.4 box1
192.168.1.5 box3
#..... and so on
EOF
While using a host name other than box I think I ran into some problems with cups.
printing from leafpad, mousepad, Gnumeric - error message in Leafpad is: "No application is registered as handling this file".
Printing works fine in Abyword, Office Writer and Geanny-editor.