I have an expect script that spawns a process, then does some initialization (authentication), then performs some task that needs prior authentication.
Considering to extend the script to execute multiple tasks after initialization, I wondered whether I could use separate expect processes to perform each task (once the spawned process terminates it needs to re-authenticate).
So that would mean:
First expect spawns a process and does initialization. Then expect exists, but leaves the spawned process active.
For each task to perform: Start another expect process that re-attaches to the process spawned earlier. This step would repeat as often as needed.
A final expect re-attaches to the spawned process and does a clean shutdown of that process.
Is that possible? The advantage would be that for many tasks, a script could be created on the fly, being executed, and then replaced by the next task's script. Otherwise I would have a very lengthy script...
interact
command can listen for patterns and automatically do stuff, that may help.ssh
to log in to some host "interactively", the send more commands to the ssh connection? I'm not quite sue how a solution might look like.https://superuser.com/questions/tagged/screen
refers todisplay
issues, which most likely not what you had in mind.