WAD PRE_EXEC executed before PROMPT2

May 20, 2008
9,144
58
Syracuse, NY, USA
Code:
v:\> set prompt2
PROMPT2=$e[32;1m+$g$s$e[0m

v:\> alias pre_exec echo foo

v:\> do i=1 to 3 (
foo
+> echo %i )
1
2
3

v:\>
 
Last edited:

rconn

Administrator
Staff member
May 14, 2008
10,885
97
WAD.

PRE_EXEC is executed after the original line has been entered. The parser subsequently determines (much later) that the line is incomplete, and prompts for the remainder. If PRE_EXEC were delayed until the line continuation, it would break a LOT of existing functionality (including aliases). And it would require a significant parser rewrite -- for AFAICT no discernible benefit.
 
May 20, 2008
9,144
58
Syracuse, NY, USA
WAD.

PRE_EXEC is executed after the original line has been entered. The parser subsequently determines (much later) that the line is incomplete, and prompts for the remainder. If PRE_EXEC were delayed until the line continuation, it would break a LOT of existing functionality (including aliases). And it would require a significant parser rewrite -- for AFAICT no discernible benefit.
I'm surprised that you can't move the test that triggers the execution of PRE_EXEC to one (or more) more appropriate locations (namely, just before execution of the command).

Maybe its name should be changed (to, say, POST_ENTER), and its description changed to better reflect what it does.