Hi - i have an unix application which receives user input and prints certain details. the problem is i am trying to automate it and i don't know how to pass a list of commands to the application using shell script. here documents don't work as well - if i use the here document when i am opening the application like
myapp << here1.txt
i receive an error because the myapp doesn't expect any user input until it fully opens. I hope i am clear
i want to be able to pass commands like tab tab and then some text to the application.
Here documents look like this - with an example delimiter of "EOF"
./myapp << EOF
\t\tsomething
EOF
Not like what you showed. A here doc becomes terminal input, emulating a user letting the program run, then answering questions.
yeah sry i was just being lazy there..
myapp << end
/t
/something
end
this doesn't work because myapp doesn't expect any input - it throws an error when i try to do that, saying: invalid input.. is there any other way to pass commands to myapp.
If i could pass commands to myapp via a here document after the program runs - then it would be a perfect solution.. is there any way to do it?
It'd help a lot to know what "myapp" actually was and what you were attempting to accomplish in it. If it really accepts input that way you could try
( sleep 5 ; echo "/t" ; echo "/something" ) | myapp
...but this won't work if it expects stdin to be a terminal.