简体   繁体   English

使用.bash_profile和.bashrc作为一个

[英]Use .bash_profile and .bashrc as one

I have the following code in my .bash_profile: 我的.bash_profile中有以下代码:

  1 [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"                                                                                           
  2                                                                                                                                                           
  3 export NVM_DIR="$HOME/.nvm"                                                                                                                               
  4 [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm                                                                                        
  5 [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion 

And the following in my .bashrc: 在我的.bashrc中,以下内容:

  1 # Add RVM to PATH for scripting. Make sure this is the last PATH variable change.                                                                         
  2 export PATH="$PATH:$HOME/.rvm/bin"

Is there an way to avoid one of the files? 有办法避免使用其中一个文件吗? I mean, only use one as both? 我的意思是,两者都只能使用?

Thank you. 谢谢。

just put following code in .bash_profile file. 只需将以下代码放在.bash_profile文件中。 Basically source the .bashrc file in .bash_profile. 基本上从.bash_profile中获取.bashrc文件。

source .bashrc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM