On 2/4/14, 2:34 AM, Michal Sojka wrote: > Bash Version: 4.2 > Patch Level: 45 > Release Status: release > > Description: > The following commands fail: > > coproc while true; do echo $RANDOM; done > cat <&${COPROC[0]} | cat > > The resulting error message is: > > bash: ${COPROC[0]}: Bad file descriptor
Bash closes file descriptors associated with coprocs in child processes, since they are pipes. It's even more careful when those child processes are part of pipelines. It's really a bad idea to have pipe file descriptors open in multiple processes; that prevents SIGPIPE generation and EOF on read when one writer exits. Chet -- ``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/