SYS
Enables a host (UNIX or Windows) command to be executed from within the Reality environment.
Syntax
SYS {hostCommand}
or
!{ }{hostCommand}
Syntax Elements
hostCommand specifies a host command.
Restrictions
The commands that you are allowed to execute using SYS depend on your Host Command Shell Security Level, set up in your security profile.
Caution
Only command line host commands should be executed using SYS. Graphical applications will run, but you may not be able to quit, with the result that the shell will hang. To recover, you will have to kill the application on the host.
Comments
hostCommand is case sensitive and must be typed as you would type it at the host command prompt.
If hostCommand is omitted, SYS displays the host command prompt. To return to TCL:
- On UNIX, enter an end-of-file character (CTRL+D).
- On Windows, enter the exit DOS command.
Entering the host command as a parameter of SYS executes it as though it were entered at the host command prompt, then returns to TCL.
Using SYS in the DataBasic PERFORM statement applies certain restrictions.
If you have TCL commands with names beginning with !,
you can disable the ! command by setting the
Note that the effect of the host command run by SYS is limited to the duration of the SYS process. Hence, commands such as env or chdir (cd), only affect your host environment for the duration of SYS, after which the environment reverts to its previous state. Such commands will however be effective during a script or some other sequence of commands run by SYS.
Creating New Commands
You can create a new TCL command to execute a host process by copying the SYS command definition item to a new item in your MD; then edit the new command definition item to show the host command in attribute 5. For example:
item-id newCommandName
001 PG
002 77C7
003
004
005 host command (optional)
An alternative method of running a host command from TCL by a single command without copying the command definition, is to create a Proc that executes a SYS command. However, this method is much less efficient.
Example 1
:
SYS
This executes the UNIX or Windows command prompt, as appropriate. For example:
$ or C:>
Example 2
(on a
UNIX system):!
ls david
or
:
!dir david
(on a
Windows system)
lists all files and directories in the host directory 'david', for example:
directory1
file1
file2
file3
Example 3
Copy the SYS definition item, rename and modify, as follows:
HOSTLIST
001 PG
002 77C7
003
004
005 ls (on UNIX) or dir (on Windows), as appropriate.
You can now enter the following at TCL:
HOSTLIST david
and you get the same list as before:
directory1
file1
file2
file3