On Mon, Jan 29, 2024 at 08:52:37PM +0700, Robert Elz wrote:
>     Date:        Mon, 29 Jan 2024 13:54:10 +0100
>     From:        Andreas Schwab <sch...@suse.de>
>     Message-ID:  <mvmjzns9u6l....@suse.de>
> 
>   | n = next?

This was my assumption as well.

> That would be a reasonable interpretation, I guess, but
> unfortunately not one which helps the current question,
> as it doesn't answer "next what?"

For the record, with bash 5.2:


unicorn:~$ cat foo
#!/bin/bash

sleep 1 &
sleep 37 &
sleep 2
time wait -n
unicorn:~$ ./foo
real 0.001  user 0.000  sys 0.001
unicorn:~$ ps
    PID TTY          TIME CMD
   1152 pts/3    00:00:00 bash
 542197 pts/3    00:00:00 sleep
 542200 pts/3    00:00:00 ps
unicorn:~$ ps -fp 542197
UID          PID    PPID  C STIME TTY          TIME CMD
greg      542197       1  0 08:59 pts/3    00:00:00 sleep 37


wait -n *does* appear to acknowledge the already-terminated child process,
despite a second child process still being active.

Reply via email to