Why does ADB commands break a bash script loop?

后端 未结 2 755
遇见更好的自我
遇见更好的自我 2020-12-06 18:21

I\'m noticing a problem when running multiple adb commands from a shell script loop most of the commands does not execute.

This is an example script.

2条回答
  •  爱一瞬间的悲伤
    2020-12-06 19:11

    adb shell connects stdin to the command running on the device, which will generally consume stdin until a EOF is reached. So these commands consume all of the rest of your device names, causing the loop to exit.

    Run adb with a stdin redirection, so they get an immediate EOF without messing with what you're trying to loop over:

    serialno=$(adb 

提交回复
热议问题