## )HOST (command)

The )HOST command allows the user to issue a command directly to the host environment and display the result without leaving the APL workspace.

When used without a command, it displays the operating system under which you are working:

                  )HOST
            IS AIX

When used with a command specified, the command is passed to the operating system and executed. For example:

                  )HOST pwd
             /usr/apl/aplx

Control-C or Break in the Interrupt menu will end the command and return to APL. Otherwise, control returns to APL when the command terminates, or after a timeout value of 10 seconds. (For finer control of the timeout, see the ŒHOST system function)

The )HOST command is highly implementation-specific, and some operating system commands may not be allowed. Points to note are:

- AIX and Linux: Interactive commands can be executed if required.

- MacOS: )HOST is not implemented under MacOS 8 and 9 except to report the OS name. Under MacOS X, )HOST is implemented. It invokes the BSD terminal shell to run Unix-style programs such as 'ls' or shell scripts. However, interactive programs are not supported.

- Windows: )HOST is implemented under Windows, although interactive programs are not supported. Note that, under Windows, many common commands are 'built-in' to the command-line shell, rather than being separate executable programs. Under Windows NT, 2000, XP and Vista, you can run these using the '`CMD`' program with the '`/C`' option. (Under Windows 95, 98 and ME, use '`COMMAND.COM /C`'). For example:

                      )HOST CMD /C DIR C:\PROG*.*
                 Volume in drive C has no label.
                 Volume Serial Number is 07D0-0B11

                 Directory of C:\

                17/11/2000  21:05       <DIR>          Program Files
                               0 File(s)              0 bytes
                               1 Dir(s)  14,522,580,992 bytes free

### Special considerations for Client-Server implementations of APLX

In Client-Server implementations of APLX, the front-end which implements the user-interface (the "Client") runs on one machine, and the APLX interpreter itself (the "Server") can run on a different machine. The two parts of the application communicate via a TCP/IP network. Typically, the Client will be the APLX front-end built as a 32-bit Windows application running on a desktop PC, and the Server will be a 64-bit APLX64 interpreter running on a 64-bit Linux or Windows server.

In such systems, )HOST allows you to specify whether the command should be executed on the Client or the Server machine. You do this by preceding the command string with either an Up Arrow † to indicate that the command should be executed on the Client, or a Down Arrow ‡ to indicate that it should run on the Server. If you do not specify, the default is that the call should take place on the Client.

In this example, the Client is running under Windows 2000, and the Server under Linux x86_64:

                )HOST †cmd /c ver
          Microsoft Windows 2000 [Version 5.00.2195]

                )HOST ‡uname -nsp
          Linux nx6125 x86_64

Topic: APLX Help : Help on APL language : System Commands : )HOST Execute operating-system command

[ Previous | Next | Contents | Index ]