Jul 9 2004, 09:30 AM
I would like to get from the environment variable HOSTNAME the name of the handheld, but it is not set. I can currently hard code it in the zaurus .profile. But is there a better way to do this. I think there is a file in /etc called HOSTNAME, but from what I can gather you can set this value to anything and it never changes any thing.
Thank you for any help
Jul 9 2004, 01:36 PM
What about using the 'hostname' command?
Jul 9 2004, 03:17 PM
I am doing this from source code, Sure I guess I could execute getHostname and have it print to a file then read the file. But I would rather use something like
hostname = getenv("HOSTNAME");
Which works on linux desktop machines
Jul 9 2004, 04:06 PM
In my /etc/rc.d/rc.local, I added the following line:
# set default hostname
this apparently causes the OS to set the proper value in /etc/HOSTNAME and also the $HOSTNAME env var.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here