"/root/.bashrc"是什么作用?

3
echo 'export PYENV_ROOT="/root/.pyenv"' >> /root/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> /root/.bashrc
echo 'eval "$(pyenv init -)"' >> /root/.bashrc
. /root/.bashrc

请问有没有人能够帮我理解这个脚本是做什么的?或者能否给我提供一个更好的解释文档。

非常感谢!

2个回答

2
你可以在这个页面的基本GitHub Checkout部分找到解释: https://github.com/yyuu/pyenv 引用自网页:

Define environment variable PYENV_ROOT to point to the path where pyenv repo is cloned and add $PYENV_ROOT/bin to your $PATH for access to the pyenv command-line utility.

$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile

Zsh note: Modify your ~/.zshenv file instead of ~/.bash_profile. Ubuntu note: Modify your ~/.bashrc file instead of ~/.bash_profile.

Add pyenv init to your shell to enable shims and autocompletion. Please make sure eval "$(pyenv init -)" is placed toward the end of the shell configuration file since it manipulates PATH during the initialization.

$ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
如果你想学习更多内容,你应该阅读这个页面中的“作为交互式非登录shell调用”的部分:https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html

嗨,Mike,非常感谢你的时间。 - Den Contre

1

从bash的手册页(man bash)中:

当启动一个非登录shell的交互式shell时,bash会从/etc/bash.bashrc和~/.bashrc读取并执行命令[...]

推荐阅读: 6.2 Bash Startup Files 来自 Bash参考手册


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接