OpenSuse Linux 上的 .bashrc 或 .bash_profile 在哪里?

发布于 2024-10-07 12:44:37 字数 962 浏览 10 评论 0原文

我正在尝试安装 rvm,它希望我编辑 .bashrc 或 .bash_profile 文件以包含 rvm...但我无法在任何地方找到这些文件。快速谷歌搜索显示,在我制作它们之前它们可能不存在(奇怪),但我看不到任何关于我应该在哪里制作它们的参考。

编辑:好的,从其中一个响应来看,看起来我需要将它们放在我的 /home 目录中...我可以使用 ls -la 来查看它们是否真的存在(它们不存在),但是当我制作文件并放入:

 [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

按照 rvm 的指示放入其中时,即使我制作了一个新的 shell,我仍然无法输入“rvm”并到达任何地方。

这是否意味着文件位于错误的位置,或者我弄错了,或者我放入其中的内容是错误的......我什至不知道从哪里开始......

我制作了文件(如root),通过输入“vi .bashrc”和vi“.bash_profile”...但是当我查看它们时,这些文件似乎仅被命名为“bashrc”和“bash_profile”。所以,我做了“mv bashrc .bashrc”,这似乎做到了这一点并隐藏了它们...但是...我仍然无法在新的 shell 中输入“rvm”...

编辑:当我输入

$HOME 时/.rvm/scripts/rvm

我收到“权限被拒绝”错误,即使是 root 时也是如此。所以我去了那里,“rvm”文件没有可执行权限,无论出于何种原因......所以我将其设置为可执行。所以现在我不再收到这个错误了......但我也仍然无法运行 RVM,即使在新的 shell 中也是如此。

解决方案:

我完全误解了“主目录的根目录”的含义,并试图将它们放在名为“home”的目录中。相反,我应该把它们放在 $HOME 指向的地方。现在文件位于正确的位置(并且 .bashrc 至少已经存在,所以我刚刚编辑了它),一切都运行良好

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.

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:

 [[ -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.

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...

Edit: When I type

$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.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

沉默的熊 2024-10-14 12:44:37

如果它们尚不存在,您应该将它们放在主目录的根目录中。

You should make them in the root of your home directory, if they don't exist already.

奈何桥上唱咆哮 2024-10-14 12:44:37

文件名前面的.表明它们是隐藏文件,因此执行ls -la看看它们是否存在。

示例 .bashrc 文件
示例 .bash_profile

bashrc 与 bash_profile

The . in front of the filename indicates that they are hidden files, so execute ls -la to see if they exist.

A Sample .bashrc File
Sample .bash_profile

bashrc vs. bash_profile

萌面超妹 2024-10-14 12:44:37

您说您以 root 身份创建了这些文件,但是您是否以 root 身份运行命令?当以尝试使用此 rvm 命令的用户身份登录时,请尝试

[[ -s "$HOME/.rvm/scripts/rvm" ]] && echo exists || echo not there

直接从 shell 运行以下行:。如果它回显“不存在”,则指定的位置不存在,这就是您的问题。

如果它显示“存在”,则目录的内容可能不是预期的内容。

但是,有必要这样手动安装RVM吗?您的发行版的包管理器是否没有可以为您解决这个问题的东西?

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 rvm command try running the line:

[[ -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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文