I need to achieve a particular effect using bash
's redirection facilities.
I know that I can redirect a file to some program's standard input:
[user@host]$ application < file.txt
The thing is, I'd like to know can I regain control of this program's input after the file content's have been passed to it. In other words, I'd like to run a command similar to the above, and then, instead of the termination of the application, I'd want it to wait for further commands from standard input (keyboard).
As I write this question, it occured to me that I could probably write another application (or a script), that would at first write some data to standard output and then act as echo, like:
[user@host]$ stdin_proxy.sh | application
Would it work, and is there any better way to do so? There are a bunch of Googleable tutorials covering this issue, but they all amount to one advice - "reopen the stdin after the file contents have been read". Hovewer, I don't have the access to the source code of application
.