[Top][All Lists]

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

Re: redirections preceded by a word with builtins inconsistent

From: Chet Ramey
Subject: Re: redirections preceded by a word with builtins inconsistent
Date: Sun, 22 May 2016 14:06:08 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.1.0

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

reply via email to

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