I have a Bash script which basically looks like this:
#!/bin/bash
command_1 &
command_a &
command_b &
command_c &
wait
echo "done"
I execute some commands in background using &
at the end of the command. Then I wait for the commands to finish with wait
. But I only want to wait for the commands a
, b
and c
, not for 1
. How can I do this? Is it possible to accomplish without collecting the PIDs of command a
, b
and c
in an array and wait for those PIDs`? (That's what I tried so far, but it is kind of complicated.).