Please enable JavaScript to view this site.

A-Shell Reference

Navigation: Subroutines > HOSTEX

Launching A-Shell with HOSTEX

Scroll Prev Top Next More

Updated August 2020; see History

xcall HOSTEX,"$ASHELL –e run myprog &"

Since A-Shell is itself a valid host operating system command (e.g. "ashell" or "ashw32.exe"), you can use HOSTEX to launch another instance of A-Shell. To make this easier, HOSTEX replaces the symbol "$ASHELL" with a portion of the command line used to launch the current instance of A-Shell; this eliminates the problem of keeping track of how A-Shell was launched, which differs among platforms and installations. Specifically, $ASHELL will expand into the full path of the A-Shell executable, plus the -i <miame.ini> switch, plus the -g <icon> switch if applicable. In addition, the following switches are replicated from the parent to the child:

-cgi; see History below

-o <settings file>

-nm

-m, -mx, provided no -m or -mx is specified in subroutine command line

-z, -zt, -zi, provided no -z, -zt, or -zi is specified in subroutine command line

For example, this command would work under either Windows or Unix, launching another instance of A-Shell using the same executable and miame.ini as the current session. The new session would run in background (or minimized under Windows) and would automatically terminate when "myprog" ended:

xcall HOSTEX,"$ASHELL –e run myprog &"

Note that the -e switch is needed to cause the child session of A-Shell to terminate when the command (in this case, "run myprog") finishes executing. Otherwise the child session will remain active at the dot prompt until it is explicitly terminated with the HOST command.

Notes

Under both Unix and Windows, spawning another copy of A-Shell will not count as another node against the node license. The license banner will be omitted from the spawned copy, but only if both the extension and the path are omitted from the command line, as in the examples. In other words, the directory c:\vm\miame\bin or /vm/miame/bin must be in the environment PATH.

If you want to launch a child copy of A-Shell in order to run another BASIC program or LIT commands, the preferred way to do this is with XCALL AMOS, which acts as a front end to HOSTEX.

Under Windows, it is possible to execute DOS (or "console) commands with HOSTEX, but only if an EXE for the command actually exists. For example, there is no copy.exe (use XCOPY instead). (The console command EXE files are usually stored in the /windows/command subdirectory.) You may also want to check out the Windows START command which is useful for executing other console commands and BAT files. (Type START /? from the command prompt for help.)

History

2020 July, A-Shell 6.5.1688:  The $ASHELL macro now includes the -cgi switch if applicable, which allows CGI programs to use HOSTEX to launch subprograms. Note that this also affects AMOS in situations where it is forced to launch a new session.

2006 May, A-Shell 4.9.956:  Add ability to replicate switches from parent to child.