Skip to main content
update tags
Link
RobertL
  • 6.9k
  • 1
  • 22
  • 39

Run script as acommands in parallel and wait for one group of commands to finish before starting the next

added 224 characters in body
Source Link
user88036
user88036

I have script including multiple commands. How can I group commands to run together ( I want to make several groups of commands. Within each group, the commands should run in parallel (at the same time). The groups should run sequentially, waiting for one group to finish before starting the next group) ... i.e.

#!/bin/bash command #1 command #2 command #3 command #4 command #5 command #6 command #7 command #8 command #9 command #10 

how can I run every 3 commands to gether? I tried:

#!/bin/bash { command #1 command #2 command #3 } & { command #4 command #5 command #6 } & { command #7 command #8 command #9 }& command #10 

But this didn't work properly ( I want to run the groups of commands in parallel at the same time. Also I need to wait for the first group to finish before running the next group)

The script is exiting with an error message!

I have script including multiple commands. How can I group commands to run together. i.e.

#!/bin/bash command #1 command #2 command #3 command #4 command #5 command #6 command #7 command #8 command #9 command #10 

how can I run every 3 commands to gether? I tried:

#!/bin/bash { command #1 command #2 command #3 } & { command #4 command #5 command #6 } & { command #7 command #8 command #9 }& command #10 

But this didn't work properly ( I want to run the groups of commands in parallel at the same time. Also I need to wait for the first group to finish before running the next group)

The script is exiting with an error message!

I have script including multiple commands. How can I group commands to run together ( I want to make several groups of commands. Within each group, the commands should run in parallel (at the same time). The groups should run sequentially, waiting for one group to finish before starting the next group) ... i.e.

#!/bin/bash command #1 command #2 command #3 command #4 command #5 command #6 command #7 command #8 command #9 command #10 

how can I run every 3 commands to gether? I tried:

#!/bin/bash { command #1 command #2 command #3 } & { command #4 command #5 command #6 } & { command #7 command #8 command #9 }& command #10 

But this didn't work properly ( I want to run the groups of commands in parallel at the same time. Also I need to wait for the first group to finish before running the next group)

The script is exiting with an error message!

added 14 characters in body
Source Link
user88036
user88036
Loading
added 14 characters in body
Source Link
user88036
user88036
Loading
Source Link
user88036
user88036
Loading