From STX Wiki
Jump to navigation Jump to search
SHELL macroname macroarguments

The SHELL command starts a new STx shell (i.e., a new STx command interpreter) to execute the subroutine macroname. Hence, your subroutine will start its existence in a clean execution environment, without any local variables set. It will, differently put, be unable to access the local and the shell variables of the caller. Much less will it be able to alter them (for a different behaviour, see below, or directly refer to the STx statements MACRO, and MACROX).

The macro source code macroname must be loaded (see the LOAD command). The macroarguments passed to the macro are stored in the variable #ARGV of the called macro. Because of the special command-line processing in STx, all string replacements are applied to, and all special parsing information (e.g. quotation marks) are removed from, macroarguments before it is assigned to #ARGV. For more information on argument passing, and parsing, see Argument Passing. For a broader information on macro programming, see Script Programming in STx. And since this is a dead link, I have searched the STx documentation for any article that may fit this description, and found the following:

  • Programming: It's only a stub, so don't bother with it.
  • Introduction: This seems more helpful, though a bit outdated and fragmentary.
  • Becoming an STx guru: This is probably the way to go if you are really new to STx. It is a longish beginner's handbook on STx programming.

If you want your subroutine to be able to access the environment of the caller, there is the MACRO command for executing the subroutine in a copy of the calling environment, and even the MACROX command for dangerously executing the subroutine directly within the caller's environment.