On 10/19/16 8:24 AM, lolilolicon wrote:
> The following correctly prints "fd=2":
>
> coproc p { head -1; }
> 2>&${p[1]} bash -c 'echo fd=2 >&2'
> cat <&${p[0]}
>
> Change 2 to 3, throws error: "bash: 3: Bad file descriptor":
>
> coproc p { head -1; }
> 3>&${p[1]} bash -c 'echo fd=3 >&3'
> cat <&${p[0]}
>
> I'm not very familiar with redirection, so I may have overlooked
> something obvious...
>
> What am I missing?
File descriptors greater than 2 are set to close-on-exec in child
processes.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/