I'm trying to automate a process that creates a binary response file using a java program wrapped by a sh script (so many things wrong with this, but not my code). The result I want requires hitting [enter] for the first prompt and 'Y'[enter] for the second prompt when running the sh script.
I got it to work on one Linux box using the following code:
echo Y > ans; ./script < ans `echo -e \\\r`
On another Linux box, it's not working (script goes into an infinite loop, again, not my code). Both boxes run the same kernel and version.
There are more elegant, straightforward ways of doing this, I'm sure. However, I need it to work consistently. I'm not convinced it isn't the way one of the boxes is setup.