Updated November 2016; see History
HOST {{switches} cmd {modifier}}
The HOST command is a special A-Shell command program. It exits the A-Shell command shell and returns to either the host operating system command level or host batch or shell-script file which was used to invoke A-Shell.
Switches
Switch |
Function |
---|---|
/S |
Display exit status of command. |
/O |
(UNIX only) Captures the stdout of the command and displays it from within A-Shell. Maximum size of the output text is 512K; if exceeded, a warning message will be displayed at the end of the output. |
/? |
Writes switch listing and usage info to the screen. |
The optional modifiers are same as can be used with HOSTEX.SBR.
Comments
If a native OS command sequence is piped into A-Shell (that is if the standard input file has been redirected), for example with the following UNIX command:
$ echo "time" | ashell
then the command sequence will be executed automatically, and once the end of the standard input file is reached, control will return automatically to the host command level. In this case, at no point does A-Shell produce a command prompt, though it is possible to use the HOST command from within a command file to terminate the execution of the command sequence prematurely.
The HOST command may also be used to perform a host machine function from within A-Shell without exiting, by specifying the command as a parameter. For example:
.host vi $0
may be used within a .DO file on a UNIX machine to invoke the UNIX editor vi. (You will then understand why A-Shell contains an implementation of VUE...)
TRACKER (which controls the screen output within A-Shell) is not able to monitor any output that occurs outside of A-Shell and thus it is a good idea to resynchronize the display after using a HOST command (by clearing the screen, for example).
Yet another use for the HOST command is to execute a host operating system function and redirect the output to a file, which is available for access from within A-Shell. For example, the following commands will create a detailed process status list in the file ps.lst, which is then displayed using the A-Shell EZTYP.LIT utility. This technique avoids the terminal handling problems (alluded to above) which are otherwise bothersome when trying to shell out to host operating system functions which do not know anything about the A-Shell display environment.
.host ps –ef > ps.lst
.eztyp ps.lst
Notes
• | When HOST is used in ATE, the keyboard is reset to normal. |
• | To resolve potential confusion between switches (which start with slashes) and UNIX commands (which may also contain slashes), HOST treats anything which does not match one of the defined switches is as a cmd. But to be more explicit, you may enclose the cmd parameter in quotes. For example: |
.HOST /s "/s/abcd"
The first /s will be treated as a switch, whereas the entire "/s/abcd" would be treated as a cmd. |
History
2016 November, A-Shell 6.3.1534, HOST.LIT 2.0(106): reduces minimum partition memory requirement from about 265K to 3K and increases the maximum output capture buffer size (when using /O) from 256K to 512K. Note that the total memory requirement when using /O has actually increased rather than decreased, but it is only required when using /O and in that case it is dynamically allocated outside the memory partition.
2011 August, A-Shell 5.1.1227, HOST.LIT 2.0(105): expands the maximum size of the buffer available to capture the output of the command from 64K to 256K and now appends a truncation warning message to it if the buffer fills up.
2011 August, A-Shell 5.1.1227, HOST.LIT 2.0(104): is now smarter about sorting out possible confusion between switches and UNIX filespecs, both of which can contain slashes. This allows unquoted commands, such as:
HOST /s/abcd
to continue to be treated as filespecs, as they were before the switches /S and /O were added in 2.0(103).
Note that the preferred way to prevent UNIX filespecs or commands from being confused with switches is to enclose them in quotes. For example:
HOST /s "/s/abcd"
In the above command line, the /s following HOST will be treated as a switch, while the "/s/abcd" will be treated as a command to execute.
2011 July, A-Shell 5.1.1222, HOST.LIT 2.0(103): now supports a help display and two new options. Prior to this change, HOST was used without switches.
2007 April, A-Shell 4.9.986, HOST.LIT 2.0(102): supports the ability to plug in your own exit subroutine to be called when A-Shell exits via the HOST.LIT command. HOST.LIT now looks for OPR:HOST.SBX, and if it is found, it loads it and calls it before exiting. (Since the OPR: account is not in the normal SBX search path, this feature should not conflict with any existing HOST.SBX routines that may exist.) If the OPR:HOST.SBX is not found, HOST just exits in the normal way.