Hello!
I'm developing a TUI program that is controlled via the commands entered into stdin.
I want to automate the process of testing: I want to write a script that would start this program with some initial input data (to set the proper state of the program) and then hand the input to me so that I can enter some values myself.
That was the brief description of the problem that I want to solve. Now, I want to simplify it:
test.sh
I want to be able to continue entering the data into cat(1) after passing the heredoc values there (without killing the first process and starting a new one to enter the data; i.e. I want to reattach to the same process).
I don't know if it would be possible, since the end of the heredoc closes the stdin and thus the program exits:
Maybe there's a way to somehow use heredoc without closing the stdin?
I'm developing a TUI program that is controlled via the commands entered into stdin.
I want to automate the process of testing: I want to write a script that would start this program with some initial input data (to set the proper state of the program) and then hand the input to me so that I can enter some values myself.
That was the brief description of the problem that I want to solve. Now, I want to simplify it:
test.sh
sh:
#!/bin/sh
cat <<__EOF__
1
2
3
__EOF__
I want to be able to continue entering the data into cat(1) after passing the heredoc values there (without killing the first process and starting a new one to enter the data; i.e. I want to reattach to the same process).
I don't know if it would be possible, since the end of the heredoc closes the stdin and thus the program exits:
$ ./test.sh
1
2
3
$ Maybe there's a way to somehow use heredoc without closing the stdin?