 <p>If the input is read by the script from <code>stdin</code>, just redirect input from a file (using a wrapper script).</p> <pre><code>#! /bin/sh test.sh &lt; data.in </code></pre> <p>If this does not work for you (i.e. you have your script calling some interactive shell program like telnet, you can use <a href="http://expect.nist.gov/" rel="nofollow noreferrer"><code>Expect</code></a> to automate the interaction.</p>