1

Android 8.1 PIXEL 2 with root access.

I have seen this asked here once before but the only solution didn't help me at all. I am going to try and make this as simple as I can for the example.

If I run the following command in terminal emulator or adb shell:

am force-stop com.myapp.frustrated

It will quit the app just fine. But when I run it in this shell script:

#!/bin/sh
am force-stop com.myapp.frustrated

Nothing happens. It is odd to me that I can do many other commands just fine in a script, but a handful of them do not work.

Any suggestions you have are much appreciated.

-2

Removing #!/bin/sh fixed my issue. Thanks

| improve this answer | |
  • 3
    Replacing it by /system/bin/sh would most likely have worked as well. Background: That line specifies the binary ("interpreter") to run this script with. As there is no /bin/sh on Android, the specified interpreter wasn't found and thus the script not run. Could you please verify that – and then integrate these facts with your answer? When done please ping me, so I can remove my comment again. – Izzy Feb 12 at 8:03
  • 1
    As a side note: on recent Android versions /bin is a symlink to /system/bin. – Irfan Latif Feb 12 at 19:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.