我使用expect
我的SSH服务器上连接:如何继续SSH服务器上输入命令时,使用期望
#!/bin/expect
set command [lindex $argv 0]
set command_connect "connect"
proc connect {} {
spawn ssh [email protected]
expect "password"
send "password\r"
interact
}
if {$command == $command_connect} {
connect
}
所有良好的工作,我可以连接到服务器,但我可以不输入命令!不知怎的,所有命令都进入我的电脑!如果我尝试清屏:
proc connect {} {
spawn ssh [email protected]
expect "password"
send "password\r"
spawn clear
interact
}
然后,我在我的电脑和SSH连接断开清屏(我回到我的控制台)!
为什么会发生这种情况,以及如何在SSH服务器上继续输入命令?
我有新的问题,也许你可以帮我 - http://stackoverflow.com/questions/38547629/how-does-i-know-whether-the-console-control-is-returned – bukashka101