# HOST > [HTML Version](host_lit.htm) _Rewritten April 2024_ **HOST \{\{switches\} cmd \{modifier\}\}** HOST is a special command used to either exit A-Shell entirely (if no arguments specified), or to temporarily reach outside it execute a command or program in the outside world—i.e. the parent shell or native operating system environment. **Parameters** _switches_ | **Switch** | **Function** | |------|------| | /S | On return from the specified cmd, display its exit status code | | /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. If /O not used, output from the cmd will not be recognized by A-Shell, causing the display to become mixed up. Use XY=0 to reset it. | | /? | Display help | _cmd_ A command or command line recognizable in the environment that A-Shell was launched from. HOST /s /o du /vm" If the command itself starts with "/s" or "/o" then you must quote the first token of the command in order to avoid confusion with the switches, e.g. HOST /o "/o/mycmd" arg2 arg 2 _modifer_ An optional single character appended to the end of the command line (separated by a space) which affects the way the command is executed. See [Command Modifiers](command_modifiers.htm.md). **Comments** When HOST is used to exit A-Shell entirely (i.e. with no arguments), if the file OPR:HOST.SBX exists, it will be XCALLed prior to the session terminating. This provides a way for applications to perform cleanup, log statistics, etc. **Example 1: interactive host command** The following UNIX example will launch the vi editor to edit the miame.ini file : .host vi "/vm/miame/miame.ini" This will take over your terminal until the vi session is exited. At that point control returns back to A-Shell, but you will need to clear the screen to get rid of the characters left behind by vi (which the A-Shell screen tracking system won't know anything about). **Example 2: redirecting host command to a file** This UNIX example generates a process list, filters it to just those lines executing ashell, sends the output to the file ps.lst and the uses the A-Shell EZTYP command to display it. .HOST ps -ef | grep ashell > ps.lst .eztyp ps.lst **Example 2: launching a command in background** By adding the '\&' command modifier (in the UNIX environment), the specified command will run as a child in background, returning control immediately to the A-Shell session, e.g. .host "rsync -a /opt/filename.zip /tmp/" >x.lst 2>\&1 \& **Example 3: launching the Windows Command Prompt** .host "cmd \$" In the above example, the '\$' command modifier causes control to return to A-Shell immediately, even though the Windows Command Prompt remains open. This is particularly useful for launching a special Windows program that works in parallel with A-Shell (such as messaging app, stock ticker, etc.) **See Also** • [HOSTEX](hostex_sbr.htm.md): Subroutine interface to HOST mechanism • [SHLEXC.LIT](shlexc_lit.htm.md): Launch Windows app registered for file type