在~/.ssh编写好blj.sh文件
#!/usr/bin/expect set timeout 30 spawn ssh -p 端口 用户名@服务器IP expect { "(yes/no)?" {send "yes ";exp_continue} "password:" {send "密码 "} } interact
这里[lindex $argv 0], [lindex $argv 1], [lindex $argv 2], [lindex $argv 3]分别代表着4个参数,然后回来终端添加sh路径