bash ~/.bash_profile 权限被拒绝

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32028183/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 13:26:11  来源:igfitidea点击:

~/.bash_profile Permissions denied

bashprofile

提问by Hyman T

I am trying add these lines export PATH=~/.rbenv/bin:$PATH eval "$(rbenv init -)"to my ~/.bash_profilehowever when ever I type ~/.bash_profileit gives me this error

我正在尝试将这些行添加export PATH=~/.rbenv/bin:$PATH eval "$(rbenv init -)"到我的~/.bash_profile但是当我输入时~/.bash_profile它会给我这个错误

-bash: /Users/ryandavila/.bash_profile: Permission denied.

-bash: /Users/ryandavila/.bash_profile: 权限被拒绝。

I tried following the instructions on Basic Github checkout (https://github.com/sstephenson/rbenv/blob/master/README.md#basic-github-checkout) but I get the same error.

我尝试按照 Basic Github checkout ( https://github.com/sstephenson/rbenv/blob/master/README.md#basic-github-checkout)上的说明进行操作,但出现相同的错误。

Just an FYI I'm very new to ruby on rails yet alone programming.

仅供参考,我对 ruby​​ on rails 还很陌生,但单独编程。

回答by Wayne Conrad

.bash_profile is not executable, which is why you get the error. To reload it after making changes, use bash's sourcecommand:

.bash_profile 不可执行,这就是您收到错误的原因。要在更改后重新加载它,请使用 bash 的source命令:

source ~/.bash_profile

Or the equivalent alias:

或等效别名:

. ~/.bash_profile

回答by igor_rb

When you type ~/.bash_profile, you are execute it. You need open this file with text editor and paste export PATH.....

当你输入 ~/.bash_profile 时,你就是在执行它。您需要使用文本编辑器打开此文件并粘贴export PATH.....