Skip to main content
added 2 characters in body
Source Link
Kusalananda
  • 355.9k
  • 42
  • 735
  • 1.1k

Yes, it's enough to use a single wait with no arguments at the end to wait for all background jobs to terminate.

Note that background jobs started in a subshell would need to be waited for in the same subshell that they were started in. You have no instance of this in the code that you show.

Note also that the question that you link to asks about checking the exit statuschecking the exit status of the background jobs. This would require wait to be run once for each background job (with the PID of that job as an argument).

Yes, it's enough to use a single wait with no arguments at the end to wait for all background jobs to terminate.

Note that background jobs started in a subshell would need to be waited for in the same subshell that they were started in. You have no instance of this in the code that you show.

Note also that the question that you link to asks about checking the exit status of the background jobs. This would require wait to be run once for each background job (with the PID of that job as an argument).

Yes, it's enough to use a single wait with no arguments at the end to wait for all background jobs to terminate.

Note that background jobs started in a subshell would need to be waited for in the same subshell that they were started in. You have no instance of this in the code that you show.

Note also that the question that you link to asks about checking the exit status of the background jobs. This would require wait to be run once for each background job (with the PID of that job as an argument).

added 187 characters in body
Source Link
Kusalananda
  • 355.9k
  • 42
  • 735
  • 1.1k

Yes, it's enough to use a single wait with no arguments at the end to wait for all background jobs to terminate.

Note that background jobs started in a subshell would need to be waited for in the same subshell that they were started in. You have no instance of this in the code that you show.

Note also that the question that you link to asks about checking the returnexit status of the background jobs. This would require wait to be run once for each background job (with the PID of that job as an argument).

Yes, it's enough to use a single wait with no arguments at the end to wait for all background jobs to terminate.

Note that the question that you link to asks about checking the return status of the background jobs. This would require wait to be run once for each background job (with the PID of that job as an argument).

Yes, it's enough to use a single wait with no arguments at the end to wait for all background jobs to terminate.

Note that background jobs started in a subshell would need to be waited for in the same subshell that they were started in. You have no instance of this in the code that you show.

Note also that the question that you link to asks about checking the exit status of the background jobs. This would require wait to be run once for each background job (with the PID of that job as an argument).

Source Link
Kusalananda
  • 355.9k
  • 42
  • 735
  • 1.1k

Yes, it's enough to use a single wait with no arguments at the end to wait for all background jobs to terminate.

Note that the question that you link to asks about checking the return status of the background jobs. This would require wait to be run once for each background job (with the PID of that job as an argument).