WAD DO and escaped redirect characters

Jan 19, 2011
604
14
Norman, OK
TCC 16.03.53 Windows XP [Version 5.1.2600]

From the command line, the following commands work...
Code:
echo `</test>`
echo ^</test^>
and both print out
Code:
</test>

Wrapping either in a DO...
Code:
do i = 1 to 5 ( echo `</test>` )
do i = 1 to 5 ( echo ^</test^> )
causes failure
Code:
TCC: (Sys) The system cannot find the file specified.
 ""
TCC: (Sys) The system cannot find the file specified.
 ""
TCC: (Sys) The system cannot find the file specified.
 ""
TCC: (Sys) The system cannot find the file specified.
 ""
TCC: (Sys) The system cannot find the file specified.
 ""

I've tried various other incarnations including using the %= universal escape sequence.
 

samintz

Scott Mintz
May 20, 2008
1,503
16
Solon, OH, USA
I'm not sure why, (most likely it passes through the parser twice), but if you double up the escapes it works.
Code:
do 5 (echo ^^</test^^>)
</test>
</test>
</test>
</test>
</test>
 
Jan 19, 2011
604
14
Norman, OK
@samintz Thanks. That got me over my immediate "get my work done" hurdle.

@vefatica That works for the back quote as well (explained in the "Escape Character" portion of the help file). However, this is not explained in the DO portion of the help file. Either the parsing of DO needs to be fixed or there needs to be an addition to the DO in the help file like...
"WARNING!!!! BE SURE TO USE THE SPECIAL ESCAPE SEQUENCES IN YOUR DO COMMANDS!!!"
 

rconn

Administrator
Staff member
May 14, 2008
12,365
150
WAD. FOR is designed as a single-line loop, so it parses each element individually (for compatibility with CMD).

DO is designed as a multi-line loop, that had the ability to execute a command group on a single line grafted on to it only very recently. Changing DO to behave like FOR would (1) require a complete rewrite of DO, and (2) break all existing DO statements. Neither of those options seems particularly desirable.
 
Jan 19, 2011
604
14
Norman, OK
FOR gets parsed once, but it looks like a single-line DO is ground through the parser twice.
WAD. FOR is designed as a single-line loop, so it parses each element individually (for compatibility with CMD).
I can live with that. I put the DO in a BTM as a multiline (with ENDDO) and it worked fine. I'll remember to use FOR for command line quickies. I just seem to recall reading in the past that DO should be used instead of FOR, but I've probably got my single-liners and multi-liners confused.

Thanks for everyone's help.

Edit: Possibly a documentation note about escaping in single- vs. multi- line should be added to DO?
 
Similar threads
Thread starter Title Forum Replies Date
vefatica TPIPE: unbalanced escaped quotes in a regex? Support 5
J Escaped Characters and Variables Support 2
S WAD Escaped "r" dropped Support 13
B How to? redirect a bunch of loop Support 4
J Can you redirect output to printer device with echo? Support 1
nickles Redirect bug? Support 4
E Redirect output from "start"-ed console Support 5
D Start program without waiting and redirect output Support 6
C redirect with TCMD 8.02 Support 4
R WAD Unusable state when using Chinese characters Support 3
C TEE command appending null characters to output Support 6
D Regexes and escape characters Support 5
vefatica Quoting file names with special characters? Support 7
vefatica How to? Add real <ESC> characters with TPIPE Support 2
C Erase all characters left or right from cursor location Support 2
Joe Caverly Unicode, Codepage 437, and line characters Support 3
gschizas Fixed Using codepage 65001 (UTF-8) breaks non-ASCII characters Support 8
vefatica Display of special characters in aliases. Support 25
J Python: TCC command line parsing removes '=' equal sign characters Support 4
C filemasks over 172 characters fail Support 5
redwdc TCC.exe opens to 11 characters x 3 rows Support 1
G Selection characters with mouse double-click Support 3
R Function #IDOW returns only 2 characters Support 10
krischik WAD Tee printing Chinese characters Support 7
Alexander How to? how can I use Cyrillic characters in the Echo command? Support 8
jadaml Echo unicode characters from UTF-8 Batch files? Support 1
V Fixed CD ~ has trash characters in it Support 5
S International characters - TYPE vs %@LINE function Support 5
Jay Sage Getting Quote Characters into a Toolbar Tab Support 12
vefatica Fixed Escaping special characters Support 1
M Problem with Extended Search and non-ASCII characters in directories names Support 3
A How to? PhraseExpress autotext/autocompletion printing unexpected characters Support 4
thedave WAD Unable to type various characters using Windows 8's onscreen keyboard Support 7
W TCMD 16: double characters Support 11
MickeyF how to work with env var with special characters in the name Support 5
vefatica Fixed TPIPE doesn't /SPLIT at characters Support 0
A Escape characters on right side of pipe Support 0
J How to? 'tab' characters in the console and clipboard 'copy' Support 1
M How to? Determine a whether vars beginning with certain characters exist... Support 5
M Another simple question re. Take Command/TCC window witdth in characters... Support 16
U Keystack mangles 'special' characters Support 6
J dir failure with some unicode characters Support 6
vefatica Random access to the characters in a string? Support 4
nikbackm @select function and TAB characters Support 1
M Overriding meanings of some characters... Support 7
T How do you echo lines with special characters to file? Support 4
Emilio III Control characters pass through? Support 6
S Strange REN problem - non-English characters Support 3
nikbackm Output of non-ascii characters via pipe Support 1
K Processing strings with % characters? Support 2

Similar threads