Sujet : coproc or whatever in bash and ksh (Was: Different variable assignments)
De : gazelle (at) *nospam* shell.xmission.com (Kenny McCormack)
Groupes : comp.unix.shellDate : 19. Oct 2024, 14:35:59
Autres entêtes
Organisation : The official candy of the new Millennium
Message-ID : <vf0cjv$3djd7$1@news.xmission.com>
References : 1 2 3 4
User-Agent : trn 4.0-test77 (Sep 1, 2010)
In article <
vf0a1h$3sn0s$1@dont-email.me>,
Janis Papanagnou <janis_papanagnou+
ng@hotmail.com> wrote:
On 19.10.2024 13:45, Kenny McCormack wrote:
In article <vec3qb$3q4ms$3@dont-email.me>,
Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
On Fri, 11 Oct 2024 22:50:10 +0200, Frank Winkler wrote:
>
... but it still doesn't solve the issue that I need the result to be
visible in the parent shell.
>
coproc { uname -sr; }
read -u ${COPROC[0]} var3
wait $COPROC_PID
echo $var3
I'm actually a fan of "coproc" in bash, and I use it in my scripting, but I
think it is overkill in most cases. [...]
>
Also, if above code is how to use co-processes in Bash, I consider
that extremely clumsy (if compared to, say, Ksh).
>
(Mileages may vary, of course.)
I think he was being intentionally verbose for pedagogic purposes.
I won't bore you with the details, but obviously a lot of the text in the
quoted 4 lines is unnecessary in practice.
Just out of curiosity, how would you (Janis) do this in ksh?
-- The randomly chosen signature file that would have appeared here is more than 4lines long. As such, it violates one or more Usenet RFCs. In order to remainin compliance with said RFCs, the actual sig can be found at the following URL: http://user.xmission.com/~gazelle/Sigs/ForFoxViewers