bash OpenSuse linux 上的 .bashrc 或 .bash_profile 在哪里?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4431029/
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
Where is .bashrc or .bash_profile on OpenSuse linux?
提问by Jenny
I'm trying to install rvm, and it wants me to edit my .bashrc or .bash_profile files to include rvm... But I can't FIND these files anywhere. A quick google search shows that they might not exist until I make them (weird), but I can't see any reference to WHERE I should make them.
我正在尝试安装 rvm,它希望我编辑我的 .bashrc 或 .bash_profile 文件以包含 rvm...但我无法在任何地方找到这些文件。一个快速的谷歌搜索显示,在我制作它们之前它们可能不存在(奇怪),但我看不到任何关于我应该在哪里制作它们的参考。
EDIT: Okay, it from one of the responses, it looks like I need to put them in my /home directory...and I can use ls -la to see if they are really there or not (they are not), but when I make the files, and put:
编辑:好的,从其中一个响应来看,看起来我需要将它们放在我的 /home 目录中……我可以使用 ls -la 来查看它们是否真的存在(它们不存在),但是当我制作文件时,并输入:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
in them, as instructed by rvm, even when I make a new shell, I still can't type "rvm" and get anywhere.
在它们中,按照 rvm 的指示,即使我制作了一个新外壳,我仍然无法键入“rvm”并到达任何地方。
Does that mean the files are in the wrong place, or that I made them wrong, or that the thing I put in them is wrong....I don't even know where to begin...
这是否意味着文件在错误的位置,或者我把它们弄错了,或者我放入它们的东西是错误的......我什至不知道从哪里开始......
I made the files (as root), by typing "vi .bashrc" and vi ".bash_profile"... but when I look at them, the files seem to be named just "bashrc" and "bash_profile". SO, I did "mv bashrc .bashrc" and that seemed to do the trick AND hid them...but...I still can't type "rvm" in a new shell...
我通过键入“vi .bashrc”和vi“.bash_profile”来制作文件(以root身份)……但是当我查看它们时,这些文件似乎只被命名为“bashrc”和“bash_profile”。所以,我做了“mv bashrc .bashrc”,这似乎解决了问题并将它们隐藏了......但是......我仍然无法在新的shell中输入“rvm”......
Edit: When I type
编辑:当我输入
$HOME/.rvm/scripts/rvm
$HOME/.rvm/scripts/rvm
I got a "permission denied" error, even while root. So I went there, and the "rvm" file doesn't have executable permissions, for whatever reason... SO I set it to be executable. So now I don't get that error anymore...but I ALSO still can't run RVM, even in a new shell.
我收到了“权限被拒绝”错误,即使是在 root 时也是如此。所以我去了那里,“rvm”文件没有可执行权限,无论出于何种原因......所以我将它设置为可执行。所以现在我不再收到那个错误了……但我仍然无法运行 RVM,即使在新的 shell 中也是如此。
SOLUTION:
解决方案:
I was completely mis-understanding what "root of your home directory" meant, and was trying to put them in the directory named "home". INSTEAD, I was supposed to put them in the place where $HOME was pointing to. Now that the files are in the right place (and .bashrc at least already existed, so i just edited it), everything is working perfectly
我完全误解了“您的主目录的根目录”的含义,并试图将它们放在名为“home”的目录中。相反,我应该把它们放在 $HOME 指向的地方。现在文件位于正确的位置(并且 .bashrc 至少已经存在,所以我刚刚对其进行了编辑),一切正常
回答by mipadi
You should make them in the root of your home directory, if they don't exist already.
如果它们不存在,您应该将它们放在主目录的根目录中。
回答by athspk
The .in front of the filename indicates that they are hidden files, so execute ls -lato see if they exist.
将.在文件名前表示,他们是隐藏文件,这样执行ls -la,看看它们存在。
回答by sorpigal
You say you created the files as root, but are you running the command as root? While logged in as the user which will attempt to use this rvmcommand try running the line:
您说您以 root 身份创建了文件,但是您是否以 root 身份运行命令?以尝试使用此rvm命令的用户身份登录时,尝试运行以下行:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && echo exists || echo not there
directly from your shell. If it echo's "not there" then the location specified does not exist and that's your problem.
直接从你的外壳。如果它回显“不在那里”,则指定的位置不存在,这就是您的问题。
If it says "exists" then the contents of the directory may not be what is expected.
如果它说“存在”,那么目录的内容可能不是预期的。
But, is it necessary to install RVM manually this way? Isn't there something available from your distribution's package manager that will take care of this for you?
但是,是否有必要以这种方式手动安装 RVM?您的发行版的包管理器中是否没有可用的东西来为您解决这个问题?

