Bug/Mystery in the phase parsing rules 1.5 and 2 CR vs redirect
Posted: 29 Jan 2020 14:57
Hi,
while building some magic macro methods I found a strange behavior:
I never saw a difference between no text at all, expanding an empty or a CR variable
Therefore I had postulated:
phase 1.5: Remove <CR>: Remove all Carriage Return (0x0D) characters
Phase 2) Process special characters, tokenize, and build a cached command block:
But now, how is this possible
Phase 1.5 removes the CR
Phase 2 handles redirects, it shouldn't know that there was a CR at all
jeb
while building some magic macro methods I found a strange behavior:
Code: Select all
@echo off
for /F "usebackq delims= " %%C in (`copy /z "%~f0" nul`) do set "$CR=%%C"
set "PROMPT=$LPHASE3$G "
echo on
set ^"var1=BEGIN-%===%3>NUL END"
set ^"var2=BEGIN-%$CR%3>NUL END"
set var
Output wrote:$ ./remoteExec.sh "phase_error_CR.bat"
<PHASE3> set "var1=BEGIN-3 END" 1>NUL
<PHASE3> set "var2=BEGIN- END" 3>NUL
<PHASE3> set var
var1=BEGIN-3 END
var2=BEGIN- END
I never saw a difference between no text at all, expanding an empty or a CR variable
Therefore I had postulated:
phase 1.5: Remove <CR>: Remove all Carriage Return (0x0D) characters
Phase 2) Process special characters, tokenize, and build a cached command block:
But now, how is this possible
Phase 1.5 removes the CR
Phase 2 handles redirects, it shouldn't know that there was a CR at all
jeb