此内容没有您所选择的语言版本。

11.2. Differences Between Running the CLI Interactively and with Files


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:
  • quit (which exits the CLI)
  • record
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.
rhq.login('rhqadmin', 'rhqadmin');

  rhq.logout();
Copy to Clipboard Toggle word wrap
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.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat