How to join several processes in the shell?

So, I made a small C ++ binary to connect to the command on the server to test it, so I started working with the following shell script:

#!/bin/bash

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

Now I also want to know how long all the processes take. I believe that I will need to make a time command for each of these processes?

Is it possible to join these processes as if they were a stream?

+3
source share
4 answers

You do not join them, you are waiton them. At the top is bash and possibly other job control shells.

+8
source

You can put your shell script, which will give you the total runtime.

0

bash fg, . , , , . , , pid .

0

1, script ,

script , - , . , , wait ( ).

2, script

script, , .

0
source

Source: https://habr.com/ru/post/1794909/


All Articles