I want to check if there is a file in an Android app's private storage through adb, so I have to use run-as <packagename>
in the command.
But it does not even let me use the if
statement:
adb exec-out "run-as myPackage "if true; then echo HELLO; fi""
gives run-as: exec failed for if: Permission denied
.
adb exec-out "if true; then echo HELLO; fi"
(without the run-as
) gives: HELLO
, as expected.
How can I use the if
statement in a run-as
command?
run-as
seems to be not smart enough to understand that whole block, it expects an executable.
adb -d exec-out run-as myPackage sh -c "if true; then echo HELLO; fi"
sh
is smart enough.
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.