2

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

1 Answer 1

-1

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

2
  • 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, 2020 at 8:03
  • 1
    As a side note: on recent Android versions /bin is a symlink to /system/bin. Feb 12, 2020 at 19:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .