简体   繁体   中英

Correct command for root access in Android

I have next example:

RootTools.isRootAvailable()
Command command = new Command(0, "echo this is a command", "echo this is another command");
try {
    RootTools.getShell(true).add(command);
}catch (IOException | RootDeniedException | TimeoutException ex) {
    ex.printStackTrace();
}

But i don't know what to write to "echo this is a command", "echo this is another command " and how to apply it for my folder without permission. Maybe you know? Thanks.

This placeholder this is a command should be replaced with bash code.

You (most likely, assuming it's not specific to Android) could run it in a Linux terminal.

The placholder echo this is a command is a perfectly valid command, and will simply echo , or print the text.

Some other command you could run are:

  1. cp copy file
  2. mv move file
  3. touch create an empty file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM