Run linux program from shell script with multi-line input
linux, shell
Solution
Prime use case for a here-document:
prog <<EOF
t
3
12
e
EOF
Problem
I want to run a specific program from a script which normally aks the user for some input (several times). For example, when I start the program in the shell and my input would be: ``` t [ENTER] 3 [ENTER] 12 [ENTER] e [ENTER] ``` where one has to wait after every line that the program wants the next input. I guess there is a solution like ``` echo t | prog echo 3 | prog echo 12 | prog echo e | prog ``` but after the first line the program runs with no input because of an empty buffer. How can I fix that?