user972014
user972014

Reputation: 3856

bash - execute multiple processes followed by another

I'm trying to do something similar to the following:

(task1 & task2) && echo "finished task1 and task2" && task3

The goal is that task1 and task2 will be executed simultaneously, and once BOTH finished, the latter command will be executed (echo and then task3)

Is that possible?

Upvotes: 1

Views: 55

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 208043

Just use:

task1 &
task2 &
wait         # for both task1 and task2 to finish
echo "finished task1 and task2"
task3

Upvotes: 2

Related Questions