Net::SSH 交互式终端脚本.如何? [英] Net::SSH interactive terminal scripting. How?
问题描述
我有几个托管网络交换机,我想通过 SSH 批量配置它们.交互式 tty 中的正常 SSH 连接没有问题.但似乎我不能只是ssh user@host command
因为它们不能正确识别命令.所以它必须是一个交互式会话.
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.
现在我有了 ruby 和 Net::SSH 库.简单的 exec!
命令也不起作用.所以我想我需要用开关模拟一个交互式终端.但我不知道从哪里开始.
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.
希望你能帮我.
推荐答案
所以我尝试了 expect
.很棒的工具.帮助了我.
So i tried expect
. Great tool. Helped me.
这篇关于Net::SSH 交互式终端脚本.如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!