I had read this before sending this message. The discussion you mention
concerns leaking named redirections from function calls. This is not what I
was trying to say. I was talking about the difference in behaviour between
the creation and the destructions of the fd. There is also the difference
in behaviour between builtins and external programs that confuses me, but
in this case I just wanted to understand the creation and the destruction.
Imho, since it is by design, there should be a mention of this is the
documentation. I'm probably nitpicking, but the reasoning behind this is
not obvious to me.

Thanks,
Adonis

2016-05-22 21:06 GMT+03:00 Chet Ramey <chet.ra...@case.edu>:

> On 5/21/16 5:16 PM, adonis papaderos wrote:
>
> > Bash Version: 4.3
> > Patch Level: 42
> > Release Status: release
> >
> > Description:
> >     When using redirections preceded by a word on builtins
> >         'i.e. : {varname}<&1'
> >         the redirection persists to the current shell.
>
> This is by design, and has been discussed previously.  One such discussion
> starts at http://lists.gnu.org/archive/html/bug-bash/2016-01/msg00156.html
> .
> Maybe it should only do it when preceded by `exec', but it never has.
>
> >         Later using {varname}<&- does not close fd.
>
> You don't precede it with an `exec', so it doesn't affect the current
> shell.  So-called `null' commands with redirections are executed in
> subshells.  This is where you need the `exec'.
>
> --
> ``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/
>

Reply via email to