Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

WAD Blank line in multi-line alias in file changes internal variables

In the example below, notice how the blank line inside the multi-line alias of test_bad.dat changes the value of the internal _cmdspec variable.

Code:
[C:\temp]ver

TCC  35.00.21 x64   Windows 11 [Version 10.0.22631.5624]

[C:\temp]alias
TCC: No aliases defined

[C:\temp]echo %_cmdspec
C:\JPSoft\TCMD35\TCC.EXE

[C:\temp]type test_good.dat

  test=` & ^
        echo "Test" & ^
        `
[C:\temp]alias /r test_good.dat

[C:\temp]echo %_cmdspec
C:\JPSoft\TCMD35\TCC.EXE

[C:\temp]unalias *

[C:\temp]type test_bad.dat

  test=` & ^

        echo "Test" & ^
        `
[C:\temp]alias /r test_bad.dat

[C:\temp]echo %_cmdspec
TCC: No closing quote
 
I don't see a blank line (in the file?). If there were one, it'd need a continuation. What are all the ampersands for? Multiline aliases, per se, seem ok.

Code:
v:\> type fooalias.txt
foo=`^
^
echo ^
^
foo`

v:\> alias /r fooalias.txt

v:\> alias foo
echo foo

v:\> foo
foo

v:\> unalias foo

v:\> alias foo
TCC: Not an alias "foo"

v:\> echo %_cmdspec
D:\tc35\TCC.EXE
 
OK, I see it now. I think it needs a continuation. This is OK (the blank line is line 3). Still wondering about the ampersands.

Code:
v:\> echo %_cmdspec
D:\tc35\TCC.EXE

v:\> type /l fooalias.txt
   1 :
   2 :   test=` & ^
   3 :   ^
   4 :         echo "Test" & ^
   5 :         `
   6 :

v:\> alias /r fooalias.txt

v:\> echo %_cmdspec
D:\tc35\TCC.EXE
 
See capture for actual file contents.
1753301418476.webp


I'm not sure it should be okay for any external file, alias or otherwise, to change the value of an internal variable like _cmdspec.
 
I don't know how it carries over to %_cmdspec, but without the continuation on the blank line, this is what you get.

Code:
v:\> type /l fooalias.txt
   1 :
   2 :   test=` & ^
   3 :
   4 :         echo "Test" & ^
   5 :         `
   6 :

v:\> alias /r fooalias.txt

v:\> alias | tail /n 2
TCC: No closing quote
TCC: D:\tc35\TCSTART.BTM [1]  No closing quote
test= &
echo="Test" & `
 
I see now. You get an alias for ECHO (with a lone `). So it's not the variable, it's the new echo!
 
Back
Top