Greg Wooledge wrote: > The 'read' example will not work as you've written it. The change to > the shell variable 'out' will be lost when the pipeline terminates. > (But you can get a very recent bash release and set the "lastpipe" > shopt to work around this.) > > If the while loop also tries to set shell variables, then it will have > the same problem (and the same possible workaround).
You are right. Turns out I didn't reset the variable between tests. Or you can put the inside-code into brackets :)