首先,编写登录脚本 login.exp 放在 ~/Documents/config/ 目录下:
#!/usr/bin/expect
set timeout 30
spawn ssh -p 28743 [lindex $argv 0]@[lindex $argv 1]
expect {
"(yes/no)?"
{send "yesn";exp_continue}
"password:"
{send "[lindex $argv 2]n"}
}
interact其次,在 iTerm 内进行设置:

ssh.png
使用快捷键 Ctrl Cmd B 即可快速登录。


