[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Discussion on wait
From: |
MacBeth |
Subject: |
Re: Discussion on wait |
Date: |
Thu, 30 Jan 2025 11:00:36 -0600 |
On Thu, Jan 30, 2025 at 2:02 AM Robert Elz <kre@munnari.oz.au> wrote:
> Date: Thu, 30 Jan 2025 06:03:18 +0300
> From: =?UTF-8?B?T8SfdXo=?= <oguzismailuysal@gmail.com>
> Message-ID: <CAH7i3Lr0rF8zMPW7m=w5qwer=
> M3wdTJK0dfztGMfOgGt2dU9vg@mail.gmail.com>
>
> 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 this:
errwait() { while wait -n || return; do :; done; }
While wait returns 0 then short-circuit and loop, otherwise return the last
command's status, which was wait.