Mac iterm2配置

末鹿安然 提交于 2020-02-18 05:29:07

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 
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!