So, it seems to me you need to make up your mind, do you want to read from a pipe, or do you want to read from a user? Your while <STDIN> consumes all of the pipe content, and then there is nothing left on STDIN. By the time you print your OK? prompt, STDIN is already at EOF, so it skips on past any intended user input.