when i try to run some commands in my android device(with root),i get the stderr as below:
StdErr:/data/data/com.scanner.cary/cache/runner[2]: su: not found
but in ADB SHELL,i input "su",there is. (222.png)
when i key down the command in ADB SHELL: "sh /data/data/com.scanner.cary/cache/runner",everything is OK.
I confused.
please help me,thks.
the sub RunCMD as below:
https://www.b4x.com/android/forum/threads/running-shell-commands-as-superuser.6886/
StdErr:/data/data/com.scanner.cary/cache/runner[2]: su: not found
but in ADB SHELL,i input "su",there is. (222.png)
when i key down the command in ADB SHELL: "sh /data/data/com.scanner.cary/cache/runner",everything is OK.
I confused.
please help me,thks.
the sub RunCMD as below:
B4X:
Sub RunCMD(str As String) As Int
Dim Command, Runner As String
Dim StdOut, StdErr As StringBuilder
Dim Result As Int
Dim Ph As Phone
StdOut.Initialize
StdErr.Initialize
File.Delete(File.DirInternalCache, "runner")
File.Delete(File.DirInternalCache, "command")
Runner = File.Combine(File.DirInternalCache, "runner")
Command = File.Combine(File.DirInternalCache, "command")
File.WriteString(File.DirInternalCache, "runner", "su < " & Command)
File.WriteString(File.DirInternalCache, "command", str & CRLF & "exit") 'Any commands via crlf, and exit at end
Log("runner:" & Runner)
Result = Ph.Shell("sh",Array As String(Runner), StdOut, StdErr)
Log("stdout:" & StdOut.tostring)
Log("StdErr:" & StdErr.tostring)
Return Result
End Sub
https://www.b4x.com/android/forum/threads/running-shell-commands-as-superuser.6886/