|
From: | Mathieu Patenaude |
Subject: | Re: Leak in BASH "named" file descriptors? |
Date: | Thu, 28 Jan 2016 13:44:34 -0500 |
On 1/27/16 1:18 PM, Mathieu Patenaude wrote:
> Hi,
>
> When using "named" file descriptors inside a function, the file descriptors
> are not automatically un-linked when the function returns, but when using
> regular "numbered" file descriptors they are automatically "destroyed".
Yes. That's the intent. The idea is that if you assign a variable, you
have a `handle' on the file descriptor and can manage it yourself. It's
closer to how open(2) works: the system selects a descriptor and tells you
what it is, and it's up to you to track it from there.
In that sense, variables assigned by redirections are similar to how
`exec' makes redirections persist beyond a single command.
(I thought this had come up before, but I couldn't find that particular
discussion.)
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
[Prev in Thread] | Current Thread | [Next in Thread] |