ECHO bug

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
echo "[!-- macro Moved reunion/reunion.html --]" ] E:\mindprod\reunion\index.html

Angle brackets are shown as square brackets.

Puts the text in the index.html but also the surrounding quotes.

I did not notice this before because I used my own MASM Echo-like utility that stopped working with Windows 7.

If you figure it is too late now to fix this, please warn folks in the documentation.
 
#2
I've had issues with that before. Somehow the quoting behavior in ECHO more
often surprises me than in other commands. I believe that using back quotes
has always worked for me. This assumes you can change your source.

echo `[!-- macro Moved reunion/reunion.html --]` ]
E:\mindprod\reunion\index.html

On Thu, Jan 28, 2010 at 6:54 AM, Roedy <> wrote:


> echo "[!-- macro Moved reunion/reunion.html --]" ]
> E:\mindprod\reunion\index.html
>
> Angle brackets are shown as square brackets.
>
> Puts the text in the index.html but *also* the surrounding quotes.
>
> I did not notice this before because I used my own MASM Echo-like utility
> that stopped working with Windows 7.
>
> If you figure it is too late now to fix this, please warn folks in the
> documentation.
>
>
>
>
>


--
Jim Cook
2010 Sundays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Monday.
 
#3
Roedy wrote:
| echo "[!-- macro Moved reunion/reunion.html --]" ]
| E:\mindprod\reunion\index.html
|
| Angle brackets are shown as square brackets.

Do you mean in your example above you used braces "[]" where the command had
angle brackets "<>"?

| Puts the text in the index.html but *also* the surrounding quotes.

AFAIK it has worked that way even in 4DOS. If you use the accent grave (also
known as back-tick, `) to quote the text you will observe what you
apparently desire, i.e. the command below (using your angle bracket to brace
substitution)

echo `[!-- macro Moved reunion/reunion.html --]` ]
E:\mindprod\reunion\index.html

will store

[!-- macro Moved reunion/reunion.html --]

in the target file. Note that any character other than the ` character
itself is written to the target without interpretation.

Another method of writing text containing characters meaningful to the
parser is the use of the TEXT command:

TEXT ] E:\mindprod\reunion\index.html
[!-- macro Moved reunion/reunion.html --]
ENDTEXT

--
HTH, Steve
 
#4
Those characters could also be escaped with ^.

And their special meaning can be turned off with SETDOS /X-6.

On Thu, 28 Jan 2010 10:28:22 -0500, Steve Fábián <> wrote:

|Roedy wrote:
|| echo "[!-- macro Moved reunion/reunion.html --]" ]
|| E:\mindprod\reunion\index.html
||
|| Angle brackets are shown as square brackets.
|
|Do you mean in your example above you used braces "[]" where the command had
|angle brackets "<>"?
|
|| Puts the text in the index.html but *also* the surrounding quotes.
|
|AFAIK it has worked that way even in 4DOS. If you use the accent grave (also
|known as back-tick, `) to quote the text you will observe what you
|apparently desire, i.e. the command below (using your angle bracket to brace
|substitution)
|
|echo `[!-- macro Moved reunion/reunion.html --]` ]
|E:\mindprod\reunion\index.html
|
|will store
|
|[!-- macro Moved reunion/reunion.html --]
|
|in the target file. Note that any character other than the ` character
|itself is written to the target without interpretation.
|
|Another method of writing text containing characters meaningful to the
|parser is the use of the TEXT command:
|
|TEXT ] E:\mindprod\reunion\index.html
|[!-- macro Moved reunion/reunion.html --]
|ENDTEXT
--
- Vince
 

rconn

Administrator
Staff member
May 14, 2008
10,096
85
#5
> echo "[!-- macro Moved reunion/reunion.html --]" ]
> E:\mindprod\reunion\index.html
>
> Angle brackets are shown as square brackets.
>
> Puts the text in the index.html but *also* the surrounding quotes.
>
> I did not notice this before because I used my own MASM Echo-like
> utility that stopped working with Windows 7.
>
> If you figure it is too late now to fix this, please warn folks in the
> documentation.
This is WAD; definitely *not* a bug. (It's also exactly how CMD.EXE
behaves.)

Did you expect ECHO would remove double quotes? (If so, why?)