编写shell脚本
#!/usr/bin/expect -f
set user caoke
set password caoke
set host 10.10.10.1
set timeout 30
spawn ssh $user@$host
expect "*assword:*"
send "$password\r"
interact
expect eof
把文件保存到 /Users/pope/ssh/test 下
打开iterm的 profiles
点击 + ,就可以创建一个标签了
修改PATH环境变量
cat /etc/profile
在最后加上这么一行
export PATH=$PATH:$MAVEN_HOME/bin:/Users/pope/ssh
然后source profile
一下使其生效
然后在命令行中就可以直接使用文件名,调用脚本登陆远程服务器了