bug-bash
[Top][All Lists]
Advanced

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

Re: Coprocess FD not available when duplicated to FD other than 1 or 2


From: Chet Ramey
Subject: Re: Coprocess FD not available when duplicated to FD other than 1 or 2
Date: Wed, 19 Oct 2016 09:41:23 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

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    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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