I'm having problems with a shell provisioning script used by Vagrant, as it's not executing source /home/vagrant/.bashrc
. I've reduced the problem down to this...
Within my VM I have a file at /home/vagrant/testfile
that contains this:
echo "In testfile"
And at the end of /home/vagrant/.bashrc
I have this:
echo "In .bashrc"
Both files are owned by the vagrant
user.
In one of my Vagrant provisioning shell scripts I have this:
echo "Hello"
source /home/vagrant/testfile
source /home/vagrant/.bashrc
echo "Goodbye"
Running vagrant provision
gives this:
Hello
In testfile
Goodbye
When I do vagrant ssh
then /home/vagrant/.bashrc
is run as usual, and I automatically see:
In .bashrc
So why does doing source /home/vagrant/.bashrc
have no effect from within my provisioning script?
.bashrc
do? I'm betting there's a test for an interactive session near the top (a check onPS1
or a check on the value of$-
or similar). – Alice