2

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

2
  • initial parsing of your command is done by your host OS/shell, which you provided no information about Commented Jan 4, 2016 at 14:43
  • 1
    adb shell 'for i in $(seq 10); do command; done' Commented May 31, 2018 at 5:05

1 Answer 1

2

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"
Sign up to request clarification or add additional context in comments.

4 Comments

interesting, but it will work out only once inside and outside the adb shell, when should repeat 10 times. The old quotation do work properly but only inside of adb shell
Try this: adb shell "for i in 1 2 3 4; do echo "1"; done"
cool, thanks it's totally working, seems the problem was with passing quotations, plz edit your answer
No problem, I am happy to help out. For some reason you can not push "seq 10" to adb shell and have to use 1 2 3 4 instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.