我的 .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 ..'
任何帮助将不胜感激!谢谢!
最佳答案
在 OSX 中,所有 session 都是登录 session ,不会获取 $HOME/.bashrc
,它们会获取 $HOME/.profile
或 $HOME/.bash_profile
。所以将以下内容放入您的 .bash_profile
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
关于bash - OSX 终端在启动时无法识别 ~/.bashrc 和 ~/.bash_profile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44658135/