On 5/16/23 8:35 PM, Aleksey Covacevice wrote:
waitjobs() { local status=0 while true; do local code=0; wait -n || code=$? ((code == 127)) && break ((!code)) || status=$code done return $status } # Eventually finishes: while true; do ( true & false & waitjobs ) && break; done
This boils down to the following

    true &
    false &
    wait -n

There is no guarantee that `wait -n' will report the status of `true', the shell may acquire the status of `false' first. It's not a bug.

Reply via email to