I have multiple scripts that I launch in background. What I want to do is to launch another script when any of previous has finished execution (theese scripts have unpredictable execution time, so I don't know which of them finish first).
Something like this
exec ./MyScript1.sh &
exec ./MyScript2.sh &
exec ./MyScript3.sh &
#Now wait until any of them finishes and launch ./MyScript4.sh
#What do I have to do?
I've read about wait shell builtin but it waits for all jobs to finish, and I need when only one of them does this. Any ideas?