Automate

Automate

Make your phone or tablet smarter with automation

Get it on Google Play

Shell command privileged

An action block that executes a shell command as a privileged user, the user starting the privileged service, i.e. superuser (root) or shell user.

The fiber will pause until the command has completed.

The command should be formatted as it would when executed at a shell prompt, that includes proper escaping. Use the cliEncode function when including a filename or other text as an argument. Currently the command isn’t executed in actual shell, e.g. bash, so built-in commands without stand-alone executables like cd, echo and test may not work, nor may “piping”, e.g. | or >, without wrapping the command in sh -c "command"

The standard output and error will contain the full text as generated by the command during its execution. The exit code is usually set to 0 (zero) for a successful execution of the command.

On Android 11+ the contents of /data/data/ may be inaccessible or immutable, if the privileged service is started as superuser (root) it may be possible to access it though /data_mirror/data_ce/null/0/ instead.

To ensure the command is executed as superuser (root) use the Shell command superuser instead.

Caution! Don’t execute a command that will shutdown or reboot the device as that may cause a boot loop.

Note! This feature isn’t officially supported, requires the privileged service, may not work on all devices.

Input arguments

  • Command — command to execute, including any arguments.
  • Working directory — directory where the command will be executed, default is external storage.

Output variables

  • Standard output text — variable to assign the STDOUT.
  • Standard error text — variable to assign the STDERR.
  • Exit code — variable to assign the exit code.
Note! This documentation is also accessible within the app from Help & feedback menu.