in reply to Emulating the cmd line pipe

IO's reply fixes your reversal of I and O file handles (though it took me a while to see that...)

It's a simple enough thing to try (did you?), and the only thing missing is that you have to make sure to close O; after the "while" loop is done, or else the script won't exit.

It would be interesting to see whether using this approach on MS-Windows might allow for pipes that work more like unix pipes.

Based on observation, I believe the difference between unix and ms-windows/dos pipline operations goes like this:

On unix:

On windows/dos: