bug-bash
[Top][All Lists]
Advanced

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

Re: mapfile documentation


From: Chet Ramey
Subject: Re: mapfile documentation
Date: Fri, 16 Mar 2018 21:13:47 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 3/16/18 3:55 PM, Greg Wooledge wrote:

>> That
>> sounds like quite a 'gotcha' and isn't mentioned in the man page
>> documentation for mapfile. Do you think it should be? Should I continue
>> this now on-list and ask for it to be mentioned?

Each process in a pipeline is run in a subshell (`lastpipe' aside), and
that is stated explicitly in the manual:

"Each command in a pipeline is executed as a separate process (i.e.,  in
a  subshell).  See COMMAND EXECUTION ENVIRONMENT for a description of a
subshell environment.  If the lastpipe  option  is  enabled  using  the
shopt builtin (see the description of shopt below), the last element of
a pipeline may be run by the shell process."

The referenced section on execution environments makes it clear that
subshells can't affect their parent's environment:

"Changes made to the subshell environment cannot affect the shell's
execution environment."

Why should this information be repeated for every builtin or shell
function that can be run in a pipeline?

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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