The following construct (sub-shell, see sh(1)) will allow redirection of the input to the terminal after finding the eof without any special code in the program: (ccat file;cat) | plotting_program A ^D should be send to end the keyboard input