Karl E. Jorgensen wrote:
On Thu, Apr 26, 2007 at 10:06:40PM -0400, H.S. wrote:In a makefile, if I have a rule to: echo $(HOSTNAME);it return a blank line, as if the variable is not set. Echoing $(HOME) works, $(LANG) works, what is the deal with $(HOSTNAME)?HOSTNAME is a variable that bash(1) sets - but it is *not* exported. You can force it to be exported by $ export HOSTNAME in your login script.But ... relying on bash is decidedly non-portable. Why not use `hostname`instead?
Yes, I discovered that yesterday and it works in the Makefile: HOST=`hostname` and I just use $(HOST) later in the Makefile.
Echoing $(HOSTNAME) on a command prompt works though.It does? Perhaps you're not using bash after all? I get: -bash: HOSTNAME: command not found Note: the $(command) construct in bash is functionally identical to `command` ... Perhaps you meant ${HOSTNAME} (note the curly brackets) at the command prompt?
Yes. Typo while writing the above message. Thanks, ->HS