iterm2 下载地址: https://www.iterm2.com/
一. 执行如下脚本
open ~/Library/Application\ Support/iTerm2/DynamicProfiles/
二. 新建vpc.json 文件并放入到上面打开的文件夹中(vpc.json 为服务器信息)
{
"Profiles": [
{
"Tags": [
"vpc",
"stock"
],
"Command": "~/soft/iterm2login.sh 22 work IP 密码",
"Badge Text": "s470",
"Name": "s470",
"Custom Directory": "No",
"Guid": "s470",
"Custom Command": "Yes"
},
{
"Tags": [
"vpc",
"ng-anti"
],
"Command": "~/soft/iterm2login.sh 22 work IP 密码",
"Badge Text": "s553",
"Name": "s553",
"Custom Directory": "No",
"Guid": "s553",
"Custom Command": "Yes"
},
{
"Tags": [
"vpc",
"web"
],
"Command": "~/soft/iterm2login.sh 22 work IP 密码",
"Badge Text": "s535",
"Name": "s535",
"Custom Directory": "No",
"Guid": "s535",
"Custom Command": "Yes"
}
]
}
三. 新建 iterm2login.sh文件, 并放到 open ~/soft/ 目录下
#!/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
四. 执行下面命令
chmod +x ~/soft/iterm2login.sh