ApplesauceOS
Read Markdown ↗Download .md

exec

Run a shell command and return combined output.

js
exec(command, asRoot = false)

Arguments

ArgumentTypeMeaning
commandstringShell command.
asRootbooleanDefault false; true requests root.

Returns

Combined output string. Service failures and the 30-second timeout throw.

Example

js
console.log(exec("id -u"));

Notes

A nonzero shell exit code is not automatically a JavaScript exception. Use execResult for reliable status checks.

All JavaScript APIs · Automation playbook