#!/usr/bin/expectset timeout 10spawn ssh-p [lindex $argv 0] [lindex $argv 1]@[lindex $argv 2]expect { "(yes/no)?" {send "yes\n"; exp_continue} "Password:" {send "<password>\n"}}expect "*< server name >*" {send "ssh [lindex $argv 3]@[lindex $argv 4]\n "}expect" *password: "{send" [lindex $argv 5]\n "} #expect eofinteract
Use Iterm to connect to server on Mac, can't save password, implement automatic password input by expect script
General company only through the springboard machine login, through the above script can achieve continuous login, specific iterm configuration reference online Other tutorials
More complex automated operations can also be achieved through the expect script
Reference:
http://blog.csdn.net/leexide/article/details/17485451
http://blog.csdn.net/ofengyajie/article/details/17840751
ITerm using expect to implement automatic remote login, log on the springboard machine