我想通过运行./script来检查Nortel路由器:
#!/bin/ksh
print "IP:"
read ip;
ping ${ip};
ssh -l default ${ip} "sho mod; en; sho int; sho node-e; sho node-a";我可以使用ssh -l用户正常使用ssh。
但对于ssh -l用户'cmd1,cmd2‘,它不会自动显示“连接到ip已关闭”。
发布于 2011-06-10 23:28:21
有一个名为expect的应用程序可以为你做这种交互/终端模拟。否则,您可以使用fabric编写脚本,甚至可以使用paramiko直接在python中编写脚本
当然,以这种方式运行命令会更好,但如果您的路由器不以这种方式接受命令,则需要模拟标准连接。
https://stackoverflow.com/questions/6308504
复制相似问题