Forking / Multi-Threaded Processes | Bash

前端 未结 8 1581
被撕碎了的回忆
被撕碎了的回忆 2020-11-30 20:39

I would like to make a section of my code more efficient. I\'m thinking of making it fork off into multiple processes and have them execute 50/100 times at once, instead of

8条回答
  •  独厮守ぢ
    2020-11-30 20:45

    Let me try example

    for x in 1 2 3 ; do { echo a $x ; sleep 1 ; echo b $x ; } &  done ; sleep 10
    

    And use jobs to see what's running.

提交回复
热议问题