mac 安装brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
mac安装expect(需要先安装brew,没有安装的话看上边)
brew install expect
mac一键登录服务器脚本
set user "zhaohh"
set host "123.126.105.34"
set password "haizhi1234!"
set timeout -1
spawn ssh $user@$host
expect "*assword:*"
send "$password\r"
interact
expect eof