2015-09-21 08:49:42 -0400, Greg Wooledge: > On Mon, Sep 21, 2015 at 07:45:25PM +0800, ziyunfei wrote: > > "Functions may be exported so that *subshells* automatically have them > > defined with the -f option to the export builtin" > > > > Technically, a child shell process forked/execed by the current shell is > > not a real subshell, am I right? > > I agree with you, but it's not clear what the best wording should be. > Exported functions only work when the (grand)child process receiving > them is another instance of bash. [...]
It's not that much the process parent/child relationship that matters. "export" if for passing things to *executed* commands (the environment is something that is passed to the execve() system call, whether in the current shell process or child or grandchild... one). -- Stephane