As DigitalRoss said, all stdouts go to the same place, and working with pipelines and shields works regardless of how deeply the functions and scripts are embedded (up to system restrictions). In the demo below, f4 demonstrates one way to execute it, and f5 demonstrates another.
$ f1 () { echo f1; } $ f2 () { echo f2; } $ f3 () { echo f3; f1; } $ f4 () { echo f4; f2; f3; } $ f4 f4 f2 f3 f1 $ f4 | tee tee.out f4 f2 f3 f1 $ cat tee.out f4 f2 f3 f1 $ f5 () { { echo f4; f2; f3; } | tee tee2.out; } $ f4 | tee tee.out f4 f2 f3 f1 $ cat tee.out f4 f2 f3 f1
source share