gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 15:10:13 24 4
gpt4 key购买 nike

我的 .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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com