[Top][All Lists]

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

Re: [patch] /* XXX - possibly run Coproc->name through word expansion? *

From: Chet Ramey
Subject: Re: [patch] /* XXX - possibly run Coproc->name through word expansion? */
Date: Tue, 19 Apr 2016 10:02:44 -0700
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.7.2

On 4/16/16 8:13 AM, Piotr Grzybowski wrote:
> Hi,
>  for some time I wanted to do:
> for((i=0;i<${WORKERS_COUNT};i++)); do
>  coproc worker$i { worker_code; };
> done;
>  and since lately I got an actual real, production, case where I had to run
> given number of workers and issue jobs for them (exactly: run N encoders in
> M co-processes and pass the list of files to encode for each worker on its
> stdin), I got the attached patch. It does the following:
> - expand the name given to coproc

I'll consider this for a future version of bash.  In the meantime you can
use `eval'.

> - if it expands to a legal identifier create the coproc

This isn't necessary; there's no reason to restrict a coproc name to
something stricter than the set of valid executable names.  I suppose
I could see restricting it to the same set of valid names as shell

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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