(not an answer, a long comment) Some similar questions:
- Shell Script: Sending input to background process - Unix & Linux Stack ...
- how to pass information to a background process in bash - Stack Overflow
- linux - Writing to stdin of background process - Server Fault
- bash - Send command to a background process - Stack Overflow
- How to pipe commands to a process running in the background? - Unix ...