linux - How do I write a script to run multiple processes in the background and have additional commands run once each individual command completes? -


i'm trying following in bash script:

for x in b c; echo foo $x; sleep 5 & y=$! ; (wait $y && echo bar $x) & done 

is possible, without adding complexity (the above example of course not work)?

edit:

of course in reality, echo foo $x; sleep 5 example, copying large file or compiling big, , second operation operations depend on first.

maybe missing using ()s , putting & on entire sub group command...

for in 1 2 3; (echo $i; sleep 5; echo end $i)& done 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -