On Thu, Jan 30, 2025 at 2:02 AM Robert Elz <k...@munnari.oz.au> wrote:
> 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> > > 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.