我在我的中有以下代码,它调用下面的脚本。该脚本一直运行良好,直到最后一行。当到达时,脚本会显示。前面的这一行工作得非常好,因此该文件明显存在。为什么这个文件对于命令来说找不到,但是对于先前的命令却可以正常工作呢?
<输出错误>
==> default: /vagrant/scripts/create_functions_dotfile.sh: 14: /vagrant/scripts/create_functions_dotfile.sh: source: not found
Vagrantfile
config.vm.provision "#{script["name"]}", type: "shell" do |shell|
shell.inline = "/bin/sh /vagrant/scripts/create_functions_dotfile.sh"
end
scripts/create_functions_dotfile.sh
#!/bin/sh
dotfile=/home/vagrant/.functions.sh
for file in /vagrant/scripts/functions/*; do
echo "cat $file >> $dotfile"
cat $file >> $dotfile
done
echo "source $dotfile" >> /home/vagrant/.bashrc
cat $dotfile
source $dotfile