OSX终端在启动时无法识别〜/ .bashrc和〜/ .bash_profile

Ben*_*den 1 macos bash terminal

我的.bashrc和.bashprofile被OSX识别的唯一方法是,如果我在终端的首选项中指定要在引导时定位的文件.有没有理由说他们没有像他们应该的那样工作?

这是我的.bashrc的内部

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # 
Load RVM into a shell session *as a function*
#Add RVM to PATH for scripting. Make sure this is the last PATH 
variable change.
export PATH="$PATH:$HOME/.rvm/bin"
smiley () { echo -e ":\\$(($??50:51))"; }
export PS1="\h\$(smiley) \e[30;1m\w\e[0m\n\$ "
Run Code Online (Sandbox Code Playgroud)

在.bash_profile里面

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # 
Load RVM into a shell session *as a function*
# Add RVM to PATH for scripting. Make sure this is the last PATH n . 
variable change.
export PATH="$PATH:$HOME/.rvm/bin"
alias b='cd ..'
Run Code Online (Sandbox Code Playgroud)

任何帮助,将不胜感激!谢谢!

Gav*_*ood 6

在OSX中,所有会话都是登录会话,不会来源$HOME/.bashrc,他们会来源$HOME/.profile$HOME/.bash_profile.所以把以下内容放入你的.bash_profile

if [ -f ~/.bashrc ]; then                                                            
 source ~/.bashrc                                                                
fi  
Run Code Online (Sandbox Code Playgroud)