方法一:推荐这个简单可行
在命令中 写上 ssh -p 2222 vagrant@127.0.0.1
ssh vagrant@192.168.10.10
密码(默认):vagrant
方法二:脚本(没试过)
~~~#/bin/bash
echo "Homestead认证……"
echo -n "login:"
read name
echo -n "password:"
read -s passwd
if [ $name = "shijf" -a $passwd = "123456" ];then
echo "认证成功,正在打开虚拟机"
cd ~/Homestead && vagrant up && atom ~/Code/larabbs/ && ssh -p 2222 vagrant@127.0.0.1
else echo "input is error!"
fi
echo "按任意键关闭虚拟机";
read a
cd ~/Homestead && vagrant halt && exit