Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to join multiple processes in shell?

So I've made a small c++ binary to connect to do a command on a server to stress test it, so i started working on the following shell script:

#!/bin/bash

for ((  i = 0 ;  i <= 15;  i++  ))
do
   ./mycppbinary test 1 &
done

Now, I also happen to want to time how long all the processes take to execute. I suppose I'll have to do a time command on each of these processes?

Is it possible to join those processes, as if they're a thread?

like image 640
kamziro Avatar asked Jun 20 '26 12:06

kamziro


1 Answers

You don't join them, you wait on them. At lest in bash, and probably other shells with job control.

like image 65
Keith Avatar answered Jun 23 '26 05:06

Keith



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!