If I have a command line program executed as a backgrounded thread (AKA with ./program &) that interacts with the command line, how can I send commands to it? Is there a way (say, using 'pipe') to send characters as though they were being inputted on the command line?
Simplified command-line example:
Without & (normal case):
~/home/temp> ./testprogram
~/home/temp> Welcome to Testprogram. Enter command:
~/home/temp> Welcome to Testprogram. Enter command: quit
~/home/temp> Goodbye!
With & (my case!):
~/home/temp> ./testprogram &
~/home/temp> Welcome to Testprogram. Enter command:
~/home/temp> quit
~/home/temp> Command not found.
A ps -e | grep testprogram shows that it's still running, but now can never terminate outside of a 'kill' command.
What would be ideal is something like the following:
~/home/temp> ./testprogram &
~/home/temp> Welcome to Testprogram. Enter command:
~/home/temp> quit
~/home/temp> Command not found.
~/home/temp> quit | /cat/proc/testprogram
~/home/temp> Goodbye!
How exactly do I do this?