On Wed, Aug 7, 2024 at 11:06 AM Chet Ramey <chet.ra...@case.edu> wrote: > > On 7/31/24 11:40 AM, Zachary Santer wrote: > > > > I think I was missing more than that. Was the original 'wait -n' > > discussion from January specific to its use within the interactive > > shell? > > No, it was due to processes exiting due to signals. But you could have > looked that up yourself.
That was a big discussion, and I wasn't a part of it. Let's not miss my point, though. The "next" in the description of 'wait -n' in the manual currently means different things depending on if you're in a script or in the interactive shell, at least given the testing of bash-5.3-alpha that I performed. In a script, 'wait -n' without id arguments doesn't appear to skip child processes that have already terminated. This is good. In the interactive shell, it does. Now I understand that this is because the list of terminated child processes that 'wait -n' currently ignores is only used in the interactive shell. If you want the behavior of 'wait -n' to be consistent between scripts and the interactive shell, then it should choose one terminated child process from the list of those that is maintained in the interactive shell, if it's nonempty, to report to the user and to clear from that list, any time it is called.