bash: start multiple chained commands in background

前端 未结 15 985
生来不讨喜
生来不讨喜 2020-12-07 22:47

I\'m trying to run some commands in paralel, in background, using bash. Here\'s what I\'m trying to do:

forloop {
  //this part is actually written in perl
          


        
15条回答
  •  清歌不尽
    2020-12-07 23:19

    Forking in a for loop:

    for i in x; do ((a; b; c;)&); done

    Example:

    for i in 500 300 100; do ((printf "Start $i: "; date; dd if=/dev/zero of=testfile_$i bs=1m count=$i 2>/dev/null; printf "End $i: "; date;)&) && sleep 1; done

提交回复
热议问题