Deutsch   English   Français   Italiano  
<vfful5$34dkv$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Lem Novantotto <Lem@none.invalid>
Newsgroups: comp.unix.shell
Subject: Re: Subjective "valuations" are all we have (Was: coprocs - again
 (Was: Different variable assignments))
Date: Fri, 25 Oct 2024 11:15:49 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <vfful5$34dkv$1@dont-email.me>
References: <lmt83dFsvbvU3@mid.individual.net> <vff6l8$31j2u$1@dont-email.me>
	<vff775$31l9b$1@dont-email.me> <vff8qc$31tk9$1@dont-email.me>
	<vffjp3$3l9t2$1@news.xmission.com> <vffoij$349j2$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 25 Oct 2024 13:15:50 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="13965b6a88a1592db5bf04f77fd1a189";
	logging-data="3290783"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/QyneRv/LNZbYf7Hq2dpO1Y8Bn/gx6vt0="
User-Agent: Pan/0.160 (Toresk; )
Cancel-Lock: sha1:kyMVpWVjmuQ0lPiEHNopeUMomHY=
Bytes: 3023

Il Fri, 25 Oct 2024 11:32:02 +0200, Janis Papanagnou ha scritto:

> what is the 'coproc' actually (beyond a "reserved word")? 

Just to clarify it to myself: I'd say that 'coproc' is a reserved word 
that introduces a command (simple or compound). The command introduced by 
the reserverd word 'coproc' is called *coprocess*.
So coproc is a reserved word, a coprocess is a command... and to me 
"coproc command" is a shell construct. Kind of.

And coproc is just the bash builtin way to realize a two-way fifo named 
pipe, besides the command mkfifo. 

> Then, depending on that; is the redirection part
> of a special case here? And that's the reason why it's listed
> explicitly? Note redirection is an orthogonal concept! Here too? 

I think it's listed explicitly just to remark the order of creation: the 
coproc two-way pipe is created *before* any other redirections.

> The
> access to the FDs is implicitly defined by 'COPROC[0]' for "output" to
> the process and 'COPROC[1]' for input to the process; is this coherent
> with 'stdin'(0) and 'stdout'(1); this at least irritates me, it's not as
> obvious as it could be.

I'd agree with you... and indeed I do! But since we have a two-way pipe, 
the input of the coprocess is on the output of the executing shell, and 
vice-versa. So maybe it's just a matter of... where do you look it from?
And if you look it from the executing shell... bah, dunno why it's the way 
it is.

> Or you want Ksh to choose the FDs, then use variables (as you can
> also generally do with non-coprocess related redirections) like
>
>  exec {IN}<&p {OUT}>&p
>
> (with arbitrary variable names, here IN and OUT chosen, which looks
> more sophisticated to me than 'COPROC[0]' and 'COPROC[1]').

Agreed. IMHO the capability to well differentiate names for input and 
output is a plus.
-- 
Bye, Lem