androidadbandroid-shell

Why passing loop into adb shell not working when running it inside shell do?


This construction failing

adb shell "for i in `seq 10`; do command; done"

But if run it separately it just fine

adb shell
root@vbox86p:/ # for i in `seq 10`; do command; done

Am I missing something?

Update:

Max OSX with zsh


Solution

  • I tried this command and it worked for me:

    adb shell "for i in 'seq 10'; do echo "1"; done"
    

    Try to change the quotation symbols in the loop.

    Edit:

    Try this instead:

    adb shell "for i in 1 2 3 4; do echo "1"; done"