This chapter deals with a gotcha that I came across while porting a script from
bash. It was a gotcha only because at the time I wasn't aware of a fairly crucial difference in the behavior of the two shells. In both
bash, the last command of a pipeline is performed in a subshell. This means that a variable assigned within the subshell is not available to the parent shell. In
ksh, the last command of a pipeline is executed in the original shell.
This isn't an issue when using the pipe to set a variable, but if the result of a pipe is sent to a loop structure that then populates variables you will use later, that is more of a problem. Once the loop completes, the variables you were going to rely ...