On 4/16/16 8:13 AM, Piotr Grzybowski wrote: > Hi, > > for some time I wanted to do: > > WORKERS_COUNT=8; > 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 functions. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/