1

我正在 mac OSX 中编写一个 bash 脚本。现在我想设置图书管理员,

echo "installing the librarian-chef gem"
gem install librarian-chef

echo "librarian-chef installing cookbooks from the recipies"
librarian-chef install

然后运行它。以便 bash 脚本的其余部分可以完成,但我一直得到这个line 31: librarian-chef: command not found

所以我认为gem安装得很好但是路径没有刷新所以不能使用?所以我尝试了

echo "librarian-chef installing cookbooks from the recipies"
source ~/.bash_profile
librarian-chef install

这样它会刷新它,但那不起作用?

./vagrant_prepare.sh: line 30: ~/.bash_profile: No such file or directory

我怎样才能安装它然后使用它有人看到这个?

顺便说一句,我确实有 bash 个人资料

 ls -a
.           .bash_history       .dropbox        .rbenv      .viminfo        Dumps           Pictures        temp
..          .bash_profile       .gem            .redis          Desktop         Library         Public          test.sh
.CFUserTextEncoding .bundler        .gitconfig      .ruby-version       Documents       Movies          VirtualBox VMs
.DS_Store       .cache          .local          .ssh            Downloads       Music           Work
.Trash          .config         .pow            .vagrant.d      Dropbox         Nexus           chronosphere.sh
4

1 回答 1

1

将此添加到您的~/.bash_profile

eval "$(rbenv init -)"

重新打开终端并再次运行脚本。

#!/bin/bash
echo "installing the librarian-chef gem"
gem install librarian-chef

echo "librarian-chef installing cookbooks from the recipies"
librarian-chef install
于 2014-11-24T02:27:16.377 回答