By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!I think these should act the same, but they don't. DO seems to get it wrong.
v:\> do i=1 to 3 ( echo foo^r^n )
foo
foo
foo
v:\> do i=1 to 3 ( echo foo^r^nbar )
foo
bar
foo
bar
foo
bar
I'm complaining about the command line DO (which hasn't been around that long). What could be simpler than I want "foo^r^n" to be echoed three times? It doesn't do it.
v:\> type dotest.btm
do i=1 to 3
echo foo^r^n
enddo
v:\> dotest.btm
foo
foo
foo
The long version of DO (in batch files) doesn't do that.
Then perhaps on the single line version, DO needs to send the command in the parentheses to the parser so that it works the same way as the multi-line version....the TCC parser only expands the first line (the DO line), and subsequent lines are passed by DO to the parser...
do i=1 to 3 ( echo foo^r^n )
do i=1 to 3
echo foo^r^n
enddo
when it appears that it already exists that way.I'm absolutely not going to create a polymorphic version of DO that behaves differently depending on whether it's a single-line or multiline DO.
Then perhaps on the single line version, DO needs to send the command in the parentheses to the parser so that it works the same way as the multi-line version.
You say that
works the same way asCode:do i=1 to 3 ( echo foo^r^n )
yet they create different output.Code:do i=1 to 3 echo foo^r^n enddo
Instead of taking comments like these as a personal attack, which puts you on a defensive footing and causes you to lash out at the person with the comment, you should step back and read it objectively.
< /soapbox>
Besides ^^r^^n, are there other gadgets that will work around it?
The ONLY reason you should ever use the single-line DO is if you want it in an alias.
v:\> do i=1 to 3 ( echo `foo^r^n` )
foo
foo
foo