help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why did coprocs fd not exist, in this sample submissed on an issue a


From: Alex fxmbsw7 Ratchev
Subject: Re: why did coprocs fd not exist, in this sample submissed on an issue as answer
Date: Thu, 30 Sep 2021 22:09:49 +0200

very good idea about mapfile, i once tested massive speedup to other ways,
i think

and i see the fds seem to be local therefore and bot inherit, as you both
say
well.. thanks

On Thu, Sep 30, 2021, 22:02 Greg Wooledge <greg@wooledge.org> wrote:

> On Thu, Sep 30, 2021 at 09:49:52PM +0200, Alex fxmbsw7 Ratchev wrote:
> > i think the middle chapter is the because, sorry i understand your
> english
> > only modestly
> > in this case of code i can easily aviod coproc then
> > thanks you
>
> You tried to do this:
>
> one=( $( < /proc/fd/$ser ) )
>
> The redirection from /proc/fd/$ser occurs in a subshell, because of the
> command substitution $( ).  Chet quoted the part of the manual that says
> coproc FDs are not available inside subshells.
>
> For anyone who's confused about this: $( ) always forks (creating a
> subshell), even if you're using the $(< file) feature as a replacement
> for $(cat file).
>
> Maybe you should consider one of these replacements:
>
> read -ra one <&"$ser"
>
> mapfile -t one <&"$ser"
>
> I don't know what your writing process is sending, so you'll have to
> choose based on that knowledge.  The first one is closest to your
> original command.
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]