Reputation: 1206
I am using perl module "Expect" to achieve automation of interactive sessions. The script intends to spawn a ssh terminal on localhost(say).So the problem is can use two spawn commands (for spawning two ssh terminals)from the same script. In that case how the two spawned process share the ssh terminal. I found that both the spawned commands actually share the ssh terminal. So the UI on terminal is actually messy. Is the above assertion true?
Question 1) If true, is there any better way of controlling the spawned process in accessing the ssh terminal.
Scenario: 1) say perl script "demo.pl" has two spawn commands which does spawn a ssh terminal locally. 2) Spawned process are actually sharing the ssh terminal from which perl script is executed.
Question 2) So is there any way to launch a totally new ssh terminal, instead of using existing one.
Upvotes: 0
Views: 537
Reputation: 61369
Terminal emulators and ssh
are distinct programs. You could spawn separate terminals, each containing an ssh
command — but interacting with them would not be possible from the script, because the terminal is handling the communication to its contained ssh
, not making it available to your script.
Your options here are to use a Perl widget package or to use a terminal emulator in "slave" mode (see the -S
option to xterm
, for example) — and in either case, you would need to track the input and output for each spawnid separately and direct it to the appropriate widget or emulator.
Upvotes: 1