I find myself having to do a series of ssh
in order to get to a particular host. What I currently do is to copy and paste the commands into the terminal, one after the another, like a machine. I'm wondering if there's a way replay these fixed commands into my terminal.
I do use tmux
, and I'm aware of tmux send
; but I'd want to be doing this "intelligently", in that I want to wait for the prompt before I send the next ssh command. I'm also aware of expect
, but the usages I've seen are where the terminal is spawn
ed from within the script and interacted from within—and the spawned terminal dies with the expect script.
What would be ideal is if I can get expect
to do its thing on the very terminal that I've open. Is there a way to do that, or are there alternatives?
interact
with the shell at the end of the expect script.