Date:        Thu, 30 Jan 2025 06:03:18 +0300
    From:        =?UTF-8?B?T8SfdXo=?= <oguzismailuy...@gmail.com>
    Message-ID:  
<CAH7i3Lr0rF8zMPW7m=w5qwer=m3wdtjk0dfztgmfoggt2du...@mail.gmail.com>

  | `while wait -n; do :; done' already does that

Not quite, after that loop $? = 0 (always) so there's no way to
tell whether or not one of the commands failed, which I suspect
was the original objective.

With some extra effort, that could be made into what is desired,
I'd suggest putting it in a function, something like

        wait_for_error() {
                local S;

                while wait -n; S=$?; [ "$S" -eq 0 ]; do :; done
                return "$S";
        }

or perhaps

        wait_for_error() {
                local S;

                while wait -n ${1:+-p "$1"}; S=$?; [ "$S" -eq 0 ]; do :; done
                return "$S";
        }

kre


Reply via email to