Net::SSH interactive terminal scripting. How?

2019-08-28 02:46发布

问题:

i have several managed network switches, and i want to batch configure them via SSH. Normal SSH connection in an interactive tty is no problem. But it seems that i can't just ssh user@host command because they do not recognize the command properly. So it has to be an interactive session.

Now i have ruby and the Net::SSH library. The simple exec!command does not work, either. So i think i need to emulate an interactive terminal with the switches. But i don't know where to start.

I hope you can help me.

回答1:

So i tried expect. Great tool. Helped me.



标签: ruby ssh