*Note that I'm trying to automate this to all be done from a script. Obviously I can do this easily manually.
Edit
After better understanding the question I can pose this question better. I am trying write commands to the stdin of a given terminal. They need to be accepted and run as commands in that terminal.
What I Need to Do:
I need to, from a shell script, open a terminal. We'll call it terminal 1. From terminal 1 I need to run a command.
Then, I need to open a second terminal (terminal 2) and run a second command and wait for that command to run to completion.
Now, the question is, how can I RETURN to terminal 1 and execute another command from within that terminal? (I then need to return to terminal 2 and execute another command but that should be an identical process to the answer for this).
There has to be some way to retain a process id for a terminal instance at the time of instantiation
gnome-terminal -e *command* <something to get PID of resulting terminal here?>
Related Answers I've Found (That don't have everything I'm looking for):
- I've already seen how to run a command and leave that terminal open:
- How to invoke bash, run commands inside the new shell, and then give control back to user?
- https://unix.stackexchange.com/questions/123103/how-to-keep-bash-running-after-command-execution
- I've seen how to run multiple commands:
- Execute multiple command onto same terminal using bash script
Disclaimer
I've been using Linux for quite awhile now and am comfortable working from with terminals. However, this is something I've never tried to do before. If I am just missing something fundamental about how terminals operate please point me in the direction of the necessary resources to get up to speed.