bash: start multiple chained commands in background

前端 未结 15 913
生来不讨喜
生来不讨喜 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:25

    You can pass parameters to a command group (having sequential commands) and run them in background.

    for hrNum in {00..11};
    do
        oneHour=$((10#$hrNum + 0))
        secondHour=$((10#$hrNum + 12))
        { echo "$oneHour"; echo "$secondHour"; } &
        wait
    done
    

提交回复
热议问题