[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: questions about coproc
From: |
Grisha Levit |
Subject: |
Re: questions about coproc |
Date: |
Thu, 9 Mar 2023 15:00:02 -0500 |
On Thu, Mar 9, 2023, 14:34 Grisha Levit <grishalevit@gmail.com> wrote:
> On Thu, Mar 9, 2023, 13:48 Britton Kerin <britton.kerin@gmail.com> wrote:
>
>> 1. no obvious way to propagate e.g. the die argument in the above
>> back to the controlling terminal.
>
>
> Maybe you mean something else by "propagate"
>
Oh, if you mean capturing the stderr output (without a temp file) you can
use another coproc for that.
$ coproc e { read -r && echo "$REPLY"; }
$ coproc c { echo err >&2; } 2>&${e[1]}
$ read -ru ${e[0]} && echo "$REPLY"
err
>