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
| Parameter | Type | Description |
|---|---|---|
command | string | The command's name. |
args | string | Optional. Arguments for the command. Shell special characters aren't allowed. |
Returns
stringThe result, as a JSON string. Use JSON.parse() to read it.
- On success:
{ "result": 1, "exitCode": 0, "response": "..." }, whereresponseis the command's output. - On failure:
{ "result": 0, "error": "..." }.
Examples
js
script.shell("example_command_name");