Skip to content

Instantly share code, notes, and snippets.

@cuiwm
Created October 13, 2017 09:49
Show Gist options
  • Save cuiwm/35733238f0b94654e2e35fecb5a85816 to your computer and use it in GitHub Desktop.
Save cuiwm/35733238f0b94654e2e35fecb5a85816 to your computer and use it in GitHub Desktop.
iTerm2里面配置自动登录
#!/usr/bin/expect
set timeout 30
spawn ssh -p [lindex $argv 0] [lindex $argv 1]@[lindex $argv 2]
expect {
"(yes/no)?"
{send "yes\n";exp_continue}
"password:"
{send "[lindex $argv 3]\n"}
}
interact
#这里[lindex $argv 0], [lindex $argv 1], [lindex $argv 2], [lindex $argv 3] 分别代表着4个参数。
#将这个文件 item2login.sh 复制到 /usr/local/bin 就可以了。 然后在iTerm2里面配置。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment