使用Vagrant从配置Shell脚本更新.bashrc [英] Update .bashrc from provisioning shell script with Vagrant
本文介绍了使用Vagrant从配置Shell脚本更新.bashrc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在尝试使用Vagrant启动新实例时,我正在尝试从配置Shell脚本向主目录中的.bashrc添加一些附加行.
I'm trying to add some additional lines to .bashrc in my home directory from the provisioning shell script when launching a new instance with Vagrant.
在shell脚本中,我有:
In the shell script I have:
set -x
sudo apt-get update
sudo apt-get install vim
echo "source /usr/local/share/chruby/chruby.sh">> ~/.bashrc
echo "source /usr/local/share/chruby/auto.sh">> ~/.bashrc
但是,在完成之后,什么都没有写入.bashrc.
However after completion nothing has been written to .bashrc.
这是完整脚本的简化版本,旨在安装Ruby/Rails.
This is a cut down version of the full script the intention of which is to install Ruby/Rails.
推荐答案
您需要提供文件的完整路径.
You need to give the full path to the file.
例如
echo "source /usr/local/share/chruby/chruby.sh" >> /home/vagrant/.bashrc
这篇关于使用Vagrant从配置Shell脚本更新.bashrc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文