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 c...@case.edu http://tiswww.cwru.edu/~chet/