1
你能告訴我爲什麼這個Expect腳本在循環模式下顯示日曆嗎? 我只想看到一個日曆。使用expect登錄併發出命令
#!/usr/bin/expect
set fid [open /Users/john/secret]
set password [read $fid]
close $fid
spawn ssh [lindex $argv 0]@[lindex $argv 1]
expect {
-re ".*Are.*.*yes.*no.*" {
send "yes\n"
exp_continue
}
"*?assword:*" {
send $password
send "\n"
exp_continue
}
"*$*" {
send "cal\r"
exp_continue
}
"*$*" {
send "exit\r"
}
非常感謝!我現在就來! – user1658549