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!