You need to post some of your own code, for your own shell then.

There's no end of ways you could have screwed up the file descriptors.