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

时间:2017-06-20 16:12:52

标签: bash macos 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\$ "

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

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

1 个答案:

答案 0 :(得分:6)

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

if [ -f ~/.bashrc ]; then                                                            
 source ~/.bashrc                                                                
fi