To demonstrate that this is the pipeline itself creating the subshell, and that the curly braces will not change anyway:
#!/bin/bash echo "Base: $BASHPID" ( echo "In (): $BASHPID" )
By doing this locally with bash 4.3, I get:
Base: 82811 In (): 82812 In {}: 82811 Pipeline, default config: X: 82813 Y: 82814 Pipeline, no {}s, default config: X: 82815 Y: 82816 Pipeline, lastpipe enabled: Y: 82811 X: 82817
Please note that since all components of the pipeline are executed simultaneously, there is no specific order from which the first output from X or Y will be output; however, when lastpipe enabled lastpipe last component of the pipeline is called in the already running and running shell ( fork() not required from the main process), which slightly changes the probability of who writes the first to stdout.
Charles Duffy Apr 27 '16 at 17:40 2016-04-27 17:40
source share