Welcome!

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

SignUp Now!

TCC v32: Parsing IF %@exec[command | command] == 0 ...?

May
13,008
174
This works in TCC v31.

Code:
v:\> if %@exec[echo foo | findstr foo] == 0 echo yes
foo
yes

in TCC v32 I get this.

Code:
v:\> if %@exec[echo foo | findstr foo] == 0 echo yes
FINDSTR: Cannot open ==
FINDSTR: Cannot open 0
FINDSTR: Cannot open echo
FINDSTR: Cannot open yes
TCC: Syntax error "@exec[echo"
Usage : IF [/I] [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...] command

What's up with that?
 
I got the same results as you in
TCC 32.10.21 x64 Windows 10 [Version 10.0.19045.4291]

However, if I use TCC-RT;
Code:
E:\Utils>tccrt ver

TCC-RT  32.10.21 x64   Windows 10 [Version 10.0.19045.4291]

E:\Utils>tccrt if %@exec[echo foo | findstr foo] == 0 echo yes
foo
yes

E:\Utils>which tccrt 
tccrt is an alias : "C:\Program Files\JPSoft\TCC_RT_%_vermajor\tcc.exe" /Q /C %1 %2 %3 %4 %5 %6 %7 %8 %9

If I start TCC.EXE with the switches /Q /C;
Code:
E:\Utils>tcc.exe /q /c ver

TCC  32.10.21 x64   Windows 10 [Version 10.0.19045.4291]

E:\Utils>tcc.exe /q /c if %@exec[echo foo | findstr foo] == 0 echo yes
foo
yes

Code:
E:\Utils>which tcc.exe
tcc.exe is an external : C:\Program Files\JPSoft\TCMD32\tcc.exe

Joe
 
I was not able to reproduce your results. I initially tried putting the exec command inside parentheses to see if that made a difference. When it worked I tried without parens and it still worked.

Code:
$ if %@exec[(echo foo | findstr foo)] == 0 echo yes
foo
yes

[R:\sd-wire-cli]
$ if %@exec[echo foo | findstr foo] == 0 echo yes
foo
yes

[R:\sd-wire-cli]
$ ver /r

TCC  32.10.21 x64   Windows 10 [Version 10.0.19045.4170]
TCC Build 21   Windows 10 Build 19045
 
Interesting! I don't know what it all means but it will probably help Rex.
 
This works;
Code:
E:\Utils>echo %@if[%@exec[echo foo | findstr foo] == 0,yes,no]
foo
yes

E:\Utils>ver 

TCC  32.10.21 x64   Windows 10 [Version 10.0.19045.4291]

Joe
 

Similar threads

Back
Top