Execute Terminal Command

Executes a command at the terminal prompt after it has connected, and returns the result of the execution.

Command availability: IBM RPA SaaS and IBM RPA on premises

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

terminalExecute --command(String) (String)=value

Dependencies

Connect to a terminal using the Connect to Terminal via SSH (terminalSshConnect) command.

Input parameters

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Command command Required Text Command that should be executed on the connected terminal.

Output parameters

Designer mode label Script mode name Accepted variable types Description
Result value Text Result of the command entered in Command input parameter.

Example

Connects to a terminal using the SSH protocol and runs a command in the terminal screen.

defVar --name terminalConnection --type Boolean
defVar --name commandExecutionSuccess --type String
defVar --name sshterminal --type Boolean
terminalSshConnect --name terminal --host "www.example.com" --username username --password password --port 22 sshterminal=value
terminalExecute --command "apt-get update" commandExecutionSuccess=value
terminalDisconnect --name terminal
Remember:Use a valid connection to connect to the server.