views:

464

answers:

2

(I looked everywhere for this, perhaps my googling skill is off today)

I have a program that requires a handful of initialization cmds from stdin (and not through arguments). It'd be nice to move those commands into a script so when the script completes I can start keying the real work. So something like:

cat initcmds.txt | myprogram.exe

the problem is that the program (child process) terminates after receiving EOF at the end of initcmds.txt. How do you do this? (Bash, Korn, cmd.exe, csh, all good)

+4  A: 

cat initcmds.txt - | myprogram.exe

Ben James
BTW, if myprogram.exe uses history commands, this seems to disable it. Not sure why.
MandoMando
A: 

I have been looking for an answer to this question for AGES! Thank you so much! It was so simple I knew unix had to have a way to do it, but it was just hard for me to google this.

Jesse