HOSTNAME: environment variable or not?
Henry Spencer
henry-lqW1N6Cllo0sV2N9l4h3zg at public.gmane.org
Fri Feb 18 16:24:50 UTC 2005
On Fri, 18 Feb 2005, bob wrote:
> On a Debian system I've been working with HOSTNAME is not an exported
> environment variable. ie.
> export | less
> doesn't show it. Nor does the C function getenv("HOSTNAME") pick it up.
> echo $HOSTNAME
> does?
Note that a variable and an *exported* variable are two different things.
A variable which is set but *not* exported is visible within the shell
that set it -- and therefore gets substituted when that shell interprets a
command using $ in an argument -- but is not passed to the commands the
shell runs, so getenv() in a command won't find it. And "export" lists
only exported variables.
Try "set | less". That's how you list *all* variables, exported or not.
Henry Spencer
henry-lqW1N6Cllo0sV2N9l4h3zg at public.gmane.org
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list