Selectively 'waiting' in a shell script
I have an application (shell script) wherein my parent process spawns off many child processes. These will exit once they have completed their task.
After spawning the processes, parent spawns another process . This spawned process will be in an infinite loop wherein it keeps asking for an user input.
At the same time, I need the parent process to do a 'wait' till all the child processes(except the 'user input process' have exited. The 'user input process wont exit as it will run infinitely' . So, once the spawned processes have exited, the parent should kill the 'user input process' and the parent should exit
parent process starts
spawn child processes # Step 1
(user input process) & # Step 2
wait for the spawned processes in Step 1
Now the processes spawned in Step 1 have died
Kill the 'user input process' (Spawned in Step 2)
Now how do I make my parent wait for all its children, except for the user input process?