Skip to content

script.shell ​

Runs a shell command that has been set up on the MODLR instance. Commands are set up in the instance's config file, which can only be arranged through support. Any other command is refused.

js
script.shell(command, ...args)

Parameters ​

ParameterTypeDescription
commandstringThe command's name.
argsstringOptional. Arguments for the command. Shell special characters aren't allowed.

Returns ​

string

The result, as a JSON string. Use JSON.parse() to read it.

  • On success: { "result": 1, "exitCode": 0, "response": "..." }, where response is the command's output.
  • On failure: { "result": 0, "error": "..." }.

Examples ​

js
script.shell("example_command_name");