我使用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