小编Lol*_*olo的帖子

从 .bash_profile 加载 .profile 还是根本不使用 bash_profile?

我在运行 Yosemite 的 MAC 上。

直到最近,我只有一个 .profile,其中我将目录添加到我的 PATH 中。

现在我有一个 .bash_profile,根据我的经验和后来在网上阅读的内容,它会导致打开终端窗口时忽略 .profile。

经过一些阅读后,我确实了解 .pofile 和 .bash_profile 有何不同。我确实知道 .bash_profile 仅在启动 shell 时被调用。

然而,我仍然不确定,对于基本用户来说,以下任一方面的缺点(如果有的话)是什么:

  • 从 .bash_profile 调用 .profile,
  • 或者直接忽略 .bash_profile 并直接从 .profile 文件中的 shell 设置我可能需要的所有环境变量。

例如,我在这里读到,由于 .bash_profile 存在时 .profile 被忽略,所以我可以添加

. ~/.profile 
Run Code Online (Sandbox Code Playgroud)

在我的 bash_profile 中调用 .profile。

或者,虽然我知道 .bash_profile 允许我设置 bash 之外不需要的变量,但我仍然可以在 .profile 中设置我需要的所有内容,并且看不到使用 .bash_profile 给我带来了什么。

environment-variables

3
推荐指数
1
解决办法
7829
查看次数

标签 统计

environment-variables ×1