Scripts can be run in the CLI either by entering the lines directly (in interactive mode), by passing a script file to the CLI using the
-f option, or by defining the function in a CommonJS module script.
Scripts that are entered interactively and scripts in a file are substantively the same, with one exception. In interactive mode, the CLI has a set of commands (Section 5.3, “Interactive CLI Commands”
). These commands are part of the CLI, and most of those commands are only
available in interactive mode. These commands cannot be referenced inside a referenced script file:
The login and logout commands are not directly available, either, but there are login and logout functions available which can be used within a script.
As with the differences between the GUI, CLI, and alert scripts, this is a matter of context. Most of the CLI-defined commands only make sense within an interactive environment, such as recording inputted commands. Outside that interactive context, other Java methods should be used.