To synchronize the merging of input and output the controlling routine must wait for the prompt before sending the next line of input. This is exactly what expect is prepared to do. -- Bill