bug-bash
[Top][All Lists]
Advanced

[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: Tue, 24 May 2016 11:23:12 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:45.0) Gecko/20100101 Thunderbird/45.1.0

On 5/24/16 1:41 AM, Dan Douglas wrote:

>> 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'.
> 
> I know POSIX allows for a subshell but don't know what the point is. I
> was confused by this when I first hit it. The subshell isn't obvious.

It's not that Posix `allows' a subshell, it requires a subshell
environment:

"If there is no command name, any redirections shall be performed in a
subshell environment."

Bash produces a subshell environment by creating a subshell.

-- 
``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/



reply via email to

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