Introduction to the ObjectScript Shell
InterSystems IRIS® provides a command-line interface (the ObjectScript shell) which is useful during learning, development, and debugging. You can use it to execute ObjectScript commands (and see their results), as well as to access various other shells. It provides an extensive line recall facility as well as several customization options.
The ObjectScript shell is sometimes called the Terminal or the Terminal prompt, which is not entirely accurate because there is also a Windows application named Terminal (which provides a way to access this shell). Where necessary, the documentation uses the more specific phrase Terminal application to refer to the Windows application.
Starting the ObjectScript Shell
You can start the ObjectScript shell in multiple ways:
On any operating system, you can use the iris terminal command, starting from an operating system prompt.
On Windows, you can use the Terminal application, which is a Windows application that presents the ObjectScript shell in a window that also provides a menu bar with additional options. The Terminal application is described separately in more detail.
You may be prompted to log in, or you may instead be logged in under a default username, depending on the security settings for the associated InterSystems IRIS server. The prompt then (by default) displays the name of the current namespace. For example, if you are in the USER namespace, the default prompt is as follows:
To switch to a different namespace, use the $namespace variable as in the following example:
This is the same way that you would switch namespaces within your code; see the $namespace reference page in the ObjectScript Reference for more information.
You can enter single-line ObjectScript commands at the prompt. No initial space character is needed, unlike lines of code within routines and classes. For example:
The shell implicitly issues the Use 0 command after each line you enter, so that any output is automatically written to the shell.
There is no multiline mode for entering commands, so the entire command must be typed on a single line. (You can, however, define routines within the shell.)
Changes in the Prompt
In specific scenarios, the prompt changes to display additional information, to indicate the program stack level or the transaction level. Also see Shells.
The Program Stack Level (Debug Prompt)
If an error occurs, the prompt includes a suffix that indicates the program stack level. For example:
Enter the Quit command to exit the debug prompt. Or debug the error; see Command-line Routine Debugging.
The Transaction Level
If you are within a transaction, the prompt includes a prefix that indicates the transaction level. The prefix is of the form TLn:, where n is the transaction level. For example, if you are in the USER namespace and you enter the ObjectScript command TSTART, the prompt changes as follows:
If you exit the ObjectScript shell, that rolls back the transaction.
To repeat a previous command, press the up arrow key repeatedly until the shell displays the desired command. To enter the command, press Enter. The ObjectScript shell also supports a more extensive line recall facility, with an option to search previous commands.
To interrupt any foreground execution, press Ctrl+Shift+c or Ctrl+c.
To exit the ObjectScript shell:
If you are currently within one of the available (secondary) shells, exit the shell (details vary).
Enter HALT or H (not case-sensitive).
If you had accessed the ObjectScript shell from the iris terminal command, the prompt then changes back to the operating system prompt. Or, if you had accessed the Terminal application, the application window then closes.