[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Windows 2000 problem

From: Paul D. Smith
Subject: Re: Windows 2000 problem
Date: Tue, 30 Jul 2002 18:30:47 -0400

I can't tell you why it works differently between W95 and W2K.  I don't
know much of anything about Windows.  Also, you don't specify what kind
of shell you're using.

But, I have an idea on why these lines wouldn't work on UNIX; maybe
you're using a UNIX-ish enough shell on Windows to be having the same



  # The next four lines do not get written!
        @echo LOGCIDATA = $(LOGCIDATA)>>  $(ENVFILE)

All the variables have the value "0".  Look at how these lines will
expand, and what command will be given to the shell:

        echo LOGSATDATA = 0>>test.txt
        echo LOGCIDATA = 0>>  test.txt
        echo LOGCISATDATA = 0>>  test.txt
        echo LOGTASKUTIL = 0>>  test.txt

Well, in UNIX shell the token sequence "0>>" is a special one that means
"redirect the contents of file descriptor 0 to the following file,
appending it to the end".  FD 0 is stdin, so what you're really doing is
redirecting the stdin of the echo command and appending it to the output
file; since there is nothing on stdin nothing gets appended.

You really, really, _really_ want to add some whitespace or quotes (or
both!) to these lines; it's very dangerous to simply concatenate tokens
like this!  I would write these lines like this:

        @echo 'LOGSATDATA = $(LOGSATDATA)'      >> $(ENVFILE)
        @echo 'LOGCIDATA = $(LOGCIDATA)'        >> $(ENVFILE)
        @echo 'LOGTASKUTIL = $(LOGTASKUTIL)'    >> $(ENVFILE)

In fact, you have other lines which are potentially not going to work
without quoting as well; some shells will treat unescaped # chars as
shell comments, not literal characters, so any line like:

        @echo # Outputs : None                  >>  $(ENVFILE)

Might not work with some shells and will work with others.  With Windows
this is probably not a major concern (how many shells do you have, after
all?)  Nevertheless, I strongly urge you to quote them and save yourself
potential future headaches:

        @echo '# Outputs : None'                >>  $(ENVFILE)

(or, you can just add a backslash before the # if you prefer:

        @echo \# Outputs : None                 >>  $(ENVFILE)



 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

[Prev in Thread] Current Thread [Next in Thread]