shell - BASH - After 'wait', why does 'jobs -p' sometimes show 'Done' for a background process? -
the short version: bash script has function.
this function launches several instances (a maximum of 10) of function in background (with &
).
i keep count of how many still active jobs -p | wc -w
in loop. when i'm done loop, break
.
i use wait
ensure processes terminate before continuing.
however, when check count (with jobs -p
) sometimes find this:
[10] 9311 done my_background_function_name $param
how can wait
proceed when launched child-processes have terminated , jobs list empty?
why jobs shown "done" , not?
clearly, knowledge of how jobs
works deficient. :)
thanks.
Comments
Post a Comment