Stating the problem in a simplified form:
I’m ssh’ing to two servers using two bash terminals and running programs on the servers whose outputs I need to continuously view. Server1’s output appears on terminal1 and Server2’s output on terminal2.
Is there a way to run a script which is aware of how many terminals are open, and be able to cycle through them and execute bash commands on them?
Pseudocode:
open terminal1
run program1
open terminal2
run program2
switch to terminal1
run program3 on terminal1
Looked at the man page for xterm, but there was no option to switch between terminals.
The closest I could get was this and this. But both didn’t help.
screen