View Full Version : %computername% equivalent
Sub101
June 30th, 2008, 01:35 PM
I expect this is a very simple thing to do but I have been Googleing this for some time and can not find the answer.
All I want to do is include in a path the computer name, without being specific to the computer. So I use the program on any of my Ubuntu machines and it all works. I know in Windows %computername% works.
Thanks for your help.
LaRoza
June 30th, 2008, 01:56 PM
I expect this is a very simple thing to do but I have been Googleing this for some time and can not find the answer.
All I want to do is include in a path the computer name, without being specific to the computer. So I use the program on any of my Ubuntu machines and it all works. I know in Windows %computername% works.
Thanks for your help.
~$cat /etc/hostname
In *nix, everything is a file.
TheEndIsNear
June 30th, 2008, 02:03 PM
If you want to create a file with the machine name in it then you would use $HOSTNAME.
LaRoza
June 30th, 2008, 02:05 PM
If you want to create a file with the machine name in it then you would use $HOSTNAME.
Just figured that out as well.
I don't know what language you are using, but usually there is a "getenv" function for this.
Sub101
June 30th, 2008, 02:22 PM
Cheers. Going to use the $HOSTNAME I think. Thanks for your help
vBulletin® v3.7.4, Copyright ©2000-2008, Jelsoft Enterprises Ltd.