1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

ECHO bug

Discussion in 'Support' started by Roedy, Jan 28, 2010.

  1. Roedy

    Joined:
    Jun 8, 2008
    Messages:
    120
    Likes Received:
    2
    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. Jim Cook

    Joined:
    May 20, 2008
    Messages:
    604
    Likes Received:
    0
    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:




    --
    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. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    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. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,938
    Likes Received:
    30
    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
     
  5. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,854
    Likes Received:
    83
    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?)
     

Share This Page