【问题标题】:Difference between .profile and .bash_profile on Snow LeopardSnow Leopard 上 .profile 和 .bash_profile 的区别
【发布时间】:2011-10-08 17:43:13
【问题描述】:

我将在我的计算机上设置 mySQl 的路径(我正在运行 Snow Leopard),但我在网上看到不同的说明。

有人说要更改 .profile 文件,有些人说要更改 .bash_profile 文件。有什么区别?

【问题讨论】:

标签: macos terminal .bash-profile


【解决方案1】:

我相信 mac OS X 环境会按此顺序检查.bash_profile.bash_login.profile。它会运行层次结构中最高的那个,所以,如果你有.bash_profile,它不会检查.profile

【讨论】:

  • 我可以确认。我刚刚安装了 google cloud sdk,它在我使用 .profile 作为所有其他变量并且许多应用程序停止工作时创建了一个 .bash_profile。
  • 我相信 .bashrc 应该在那个列表中?
  • @tscizzle - 提到的列表对登录 shell 有效
  • 使答案完整-您能否添加 .bashrc 的角色?我读到“登录外壳”和“非登录交互式外壳”之间存在区别,我不太明白 - 但您仍然可以添加说明 - 所有这些 .bash_xxxxx 都是用于“登录外壳”(无论它们可能是)和 .bashrc 对于其他人。
【解决方案2】:

.profileshbash 一起使用。但是.bash_profile 是特定于 bash 的,如果存在.profile,它将覆盖。

【讨论】:

  • 我相信 .bash_profile 会覆盖 .profile,而不是相反,但我还没有测试过。
  • 我刚刚测试过,.bash_profile 确实似乎覆盖了 .profile
  • 谢谢两位 - 我会修复答案。
  • .bashrc文件什么时候会按顺序执行?
  • 在 Mac 上永远不会。您需要在您的.bash_profile 中添加source ~/.bashrc
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2010-11-04
  • 2010-12-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多