Fixed multi-line alias issue

May 20, 2008
473
2
My alias file has some that are multi-line. Here is one example:
Code:
 clearrecent= & ^
    iff %@len[%RecentPath] GT 0 then & ^
       del /q "%RecentPath\*.lnk" & ^
       cls & ^
    endiff

All my my aliases in the file that start with ...= & ^ are no longer being loaded by alias /r. Other aliases in the file, even after these, are loaded as expected.

ver /r
TCC 16.00.30 Windows 7 [Version 6.1.7601]
 
May 20, 2008
11,414
99
Syracuse, NY, USA
I can comfirm this. With v15, all's well.
Code:
v:\> ver

TCC  15.01.58  Windows 7 [Version 6.1.7601]

v:\> tail /n2 h:\ShrDump\alias.sav
zz=echo foo & ^
echo bar

v:\> alias /r h:\ShrDump\alias.sav

v:\> alias | tail /n1
zz=echo foo & echo bar

v:\> zz
foo
bar

v:\> unalias zz
With v16 ...
Code:
v:\> ver

TCC  16.00.30  Windows 7 [Version 6.1.7601]

v:\> tail /n2 h:\ShrDump\alias.sav
zz=echo foo & ^
echo bar

v:\> alias /r h:\ShrDump\alias.sav

v:\> alias | tail /n1
echo=bar

v:\> alias zz
TCC: Not an alias "zz"
 
May 20, 2008
11,414
99
Syracuse, NY, USA
And "FUNCTION /R" exhibits similar behavior. Comparing v16 to v15 ...
Code:
v:\> ver

TCC  16.00.30  Windows 7 [Version 6.1.7601]

v:\> type h:\ShrDump\Function.sav
zz=%@right[^
3,foobar]

v:\> function /r h:\ShrDump\Function.sav

v:\> function
TCC: No functions defined
Code:
v:\> ver

TCC  15.01.58  Windows 7 [Version 6.1.7601]

v:\> type h:\ShrDump\Function.sav
zz=%@right[^
3,foobar]

v:\> function /r h:\ShrDump\Function.sav

v:\> function
zz=%@right[3,foobar]

v:\> echo %@zz[]
bar
 
May 20, 2008
473
2
Why not just put the alias on a single line:

clearrecent=iff %@len[%RecentPath] GT 0 then & del /q "%RecentPath\*.lnk" & cls & endiff
I do combine the lines sometimes. For my OP, I used a relatively simple 'real' example. There are much longer aliases with multiple nested blocks. The more lines there are, the easier it is to read/edit when those lines are separated.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Yes, multiline may be more readable, but I always* figured that overly complex aliases ought to be batch files. Furthermore, when there is neither elseiff nor else branch I normally use a simple if and - if needed - a command group in parentheses, which are easily discernible by the eye.
"Always*" - not in 4DOS days, just since drives became very fast and very efficiently buffered, or when I could use a virtual disk in internal storage.

Rex, what about the issue of multiline aliases not loading with alias /r without /z?
 
May 20, 2008
473
2
"Always*" - not in 4DOS days, just since drives became very fast and very efficiently buffered, or when I could use a virtual disk in internal storage.
Some of these date back to 4DOS and, when a pattern is set, the next variation may follow that pattern. I typically use an alias if it does not set any internal environment variables or if any nested commands are not also externally used and might work better as a gosub.
 
May 31, 2008
382
2
Rex, you marked this issue fixed. I tested v. 16.00.32 but I'm still having problems. The following fragment from my alias file ends up redefining ECHO
Code:
file.p2clip=^
*echo %@full[%@if[0 == %@len[%@path[%1]],%_cwd\]%@filename[%1]] >clip:
 

rconn

Administrator
Staff member
May 14, 2008
12,363
150
Rex, you marked this issue fixed. I tested v. 16.00.32 but I'm still having problems. The following fragment from my alias file ends up redefining ECHO
Code:
file.p2clip=^
*echo %@full[%@if[0 == %@len[%@path[%1]],%_cwd\]%@filename[%1]] >clip:

That works fine here. Do you have any trailing whitespace on the first line?
 
May 31, 2008
382
2
Meanwhile I have switched to another PC and it is working now. So, maybe earlier today I had not properly reset the environment after upgrading from build 30 to build 32. I'll let you know if it happens again. Thanks.
 
Similar threads
Thread starter Title Forum Replies Date
B Alias with multi line definitions not assigned Support 6
D How to use multi-line DO to loop through first level directory names Support 5
vefatica FFIND and multi-line regular expressions Support 4
vefatica Single-line DO inside nested multi-line DOs? Support 9
rps Multi-column DIR /v not displaying all files. Support 5
D xp support and multi-license Support 5
T WAD Difference between TCC and CMD in handling multi-command lines Support 6
V V - Multi-Pane File Manager Support 14
Daniel P How to Purchase a Multi-System License for TCC? Support 2
T Closing multi-tab TCMD crashes Support 4
D Individual vs multi-system licenses Support 1
C Language setup files, to use in creating similar for Multi-Edit Support 2
C How to? Multi-Display Configuration Support 5
C multi-INI file merging Support 1
T VIEW only works from command line Support 14
vefatica `Back quotes` - command line vs. batch file Support 5
Phileosophos Is there any way to open the Take Command options dialog from the command line? Support 8
Phileosophos Command-line Editing Shortkeys That Fail Support 6
D Open Windows 10 Photos app from command line Support 11
Peter Murschall Single-line Do-CMD is a bit uncooperative. Support 6
Jesse Heines Strange Line Wrapping Behavior Support 14
fpefpe How to? command echo in title line/bar Support 2
vefatica Command line DO with no closing parenthesis? Support 9
R Long commands retrieved from command history have blank line when wrapped Support 20
M No line wraps if last line of the screen buffer is reached Support 5
Joe Caverly No blank line in TEXT...ENDTEXT in a LIBRARY function Support 8
R CMDebug, dark theme, current line Support 7
vefatica IDE - when breakpoint is on a blank line? Support 3
D Double Quote in TC Tool Bar Button Command line Support 3
Joe Caverly Expand all aliases on the command line Support 2
vefatica How do I do this with a multiple-line DO? Support 7
Jay Sage Cannot Postion Cursor in Command Line Using Mouse Support 7
vefatica Windows 10 and line wrapping selection? Support 6
vefatica IDE.EXE's command line? Support 19
x13 TPIPE /REPLACE - Remove line (including EOL) Support 3
D btm file command line augments comparing for string or math. Support 12
D Grabbing html text with @line Support 3
Chen Touboul Overtyping issue - i press the Insert key, help till press enter for new line in TCC Support 2
P Escape key no longer clears command line in v24 Support 21
J File explorer handling from command line? Support 2
M Ctrl-C when using command line history does nothing Support 2
M Command line parsing differences between cmd.exe and TCC Support 6
C Replace 1st argument on command line Support 4
vefatica Library functions and line continuations? Support 4
Joe Caverly Works in debugger, not from cmd line Support 1
P No linefeed on last line of console window Support 2
K Command Line Selection Not Working Support 12
J Error running Python at command line Support 9
Joe Caverly PSHELL Blank Line Display Support 2
rps How to? Alias/Command line use of *log on/off Support 2

Similar threads