I would expect the following loop to exit after one (or maybe two)
iterations but it runs until PIDs get recycled:

$ : & while [[ $(jobs) ]]; do :; done
[1] 61589
TRACE: pid 51259: delete_old_job: found pid 61589 in job 0 with state 4

The loop does not terminate because jobs just keeps printing [1]+ Done :.

Hitting ^C during this loop sometimes puts the shell in a really weird
state, with half the output echoed back and half seemingly going to
readline but not echoed back. Sometimes bash: wait_for: No record of
process xxxxx is printed.
​

Reply via email to