[Top][All Lists]

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

Re: Problems with echo. (echo period)

From: Aaron Shatters
Subject: Re: Problems with echo. (echo period)
Date: Tue, 17 Apr 2007 21:34:52 -0700 (PDT)

>Btw, you can have an empty line with cmd's echo if you say `echo""'.

No, for the cmd.exe shell, echo"" doesn't seem to be working.

> shall-i-invoke-a-shell-command-because-of-redirection-or-other-tricky-stuff
> vs. shall-i-just-invoke-the-command-executable-itself-directly decision stuff?

Yes, that is what the problem is.

As for why it is useful to be able to use this feature... consider the 

@echo $(VARIABLE)

will print "ECHO is off." if VARIABLE is undefined

I suppose that you could do

@echo $(VARIABLE)

but, often times, using other make utilities such as clearmake, dmake, omake... 
the following is done


@echo "$(VARIABLE)"

or the portable implementation:



ECHO = echo.

ECHO = echo "

This allows VARIABLE to be undefined, resulting in a blank line instead of 
"ECHO is off."  This also allows you to prefix preformatted whitespace to the 
text being echo'ed.

I'm sure that there are nifty workarounds to not being able to use "echo.", but 
it seems like the more appropriate thing to do would be to fix make.

One of the workarounds is to do this:

ECHO = echo.

Since echo never really prints to stderr, this is not going to cause any 
problems, but it does force make to use batch mode because it finds a '>' 
character in the command.  This is pretty much a hack.

And if the next question is, why is this so important?... the answer is... it's 
not because there are probably 12 different ways to work your way around it, 
however, it is useful to be able to use the shell, in all of it's glory, 
without trying to invent hacks to get around some make limitation.  It's also 
useful to be compatible with other make utilites as much as possible.

Is there any disagreement that this is a limitation of make, and that it 
probably should be fixed?

If not... just add

#ifdef WINDOWS32
      case '.':
        /* Handle special case where echo is immediately following by a '.' */
        if ((!unixy_shell) &&
            (0 == i) &&
            ((p - line) >= 4) &&
            (0 == strncmp(p-4,"echo",4)))
          goto slow;
        /* intentionally omit break;, fall through to default */

in front of

        *ap++ = *p;

in the "construct_command_argv_internal" function

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

reply via email to

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