Implement $VAR expansion in commands (issue #25)
Extend read_command_body() to detect $NAME and trigger interpolation
using the same fragment-split mechanism as ${expr}. The lexer collects
the identifier into cmd_envvar; the parser's unified parseinterp()
branches on it to emit tostring(getenv(NAME)).
This commit is contained in:
1
llex.h
1
llex.h
@@ -80,6 +80,7 @@ typedef struct LexState {
|
||||
TString *envn; /* environment variable name */
|
||||
TString *brkn; /* "break" name (used as a label) */
|
||||
TString *glbn; /* "global" name (when not a reserved word) */
|
||||
TString *cmd_envvar; /* envvar name for $NAME in commands */
|
||||
lu_byte cmd_mode; /* 0=normal, 1=backtick command, 2=interactive command */
|
||||
lu_byte saved_cmd_mode; /* cmd_mode to restore after interpolation */
|
||||
} LexState;
|
||||
|
||||
Reference in New Issue
Block a user