<p>I'd like to write a script that (under certain conditions) will execute gdb and automatically run some program X with some set of arguments Y.  Once the program has finished executing the user should remain at gdb's prompt until s/he explicitly exits it.</p>
<p>One way to do this would be to have the script output the run command plus arguments Y to some file F and then have the script invoke gdb like this:</p>
<pre><code>gdb X &lt; F
</code></pre>
<p>But is there a way to do this without introducing a temporary file?</p>

```
cat F | gdb X
```
should be identical. So you can use anything that produces output and pipe that into gdb instead of the cat command here.
I'm assuming you're correct and gdb reads from stdin.