为什么我的流浪引导文件,不修改bash_login? [英] Why is my Vagrant bootstrap file not modifying bash_login?

查看:271
本文介绍了为什么我的流浪引导文件,不修改bash_login?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我SSH到我的流浪中,我想它运行以下两个命令;

When I SSH into my Vagrant box, I would like it to run the following two commands;

cd /vagrant
git status

所以我自然会改变我的〜/ .bash_login文件做到这一点。

So naturally I would modify my ~/.bash_login to do this

cat << EOF | sudo tee -a ~/.bash_login
cd /vagrant
git status
EOF

如果我然后退出,和ssh回到我的盒子 - 它的工作原理

If I then exit, and ssh back into my box - it works!

于是我说那些确切的命令,我bootstap.sh配置文件,让我的每一个框已预时候,它会自动将它添加到我的bash_login脚本。

So then I added those exact commands to my bootstap.sh provisioning file, so that each time my box is provisioned, it would add it automatically to my bash_login script.

除了它不工作。配置过程中的输出显示了它包括两个命令,但是当后来我SSH入禁区没有任何反应。如果我认为我的bash_login文件 - 变化是不存在

Except it doesnt work. The output during provisioning shows it including the two commands, but when I then SSH into the box nothing happens. If I view my bash_login file - the changes are not there?

任何想法,为什么不呢?我想知道如果也许当我ssh入禁区,我当正在供应的盒子比一个不同的用户,所以当我编辑bash_login剧本我编辑工作其他用户的文件吗?

Any ideas why not? I'm wondering if perhaps when I SSH into the box, I am a different user than when the box is being provisioned, so when I edit the bash_login script I am editting another user's file?

推荐答案

确定 - 我的工作了。如果有人遇到同样的问题 - 我是编辑工作的错误的bash文件。这工作;

Ok - I worked it out. In case anyone comes across this same issue - I was editting the wrong bash file. This works;

cat << EOF | sudo tee -a /home/vagrant/.bashrc
cd /vagrant
git status
EOF

这篇关于为什么我的流浪引导文件,不修改bash_login?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆