ire*_*ses 25
它没有被称为bash_profile
,但全局 bash 配置的标准位置是/etc/bash.bashrc
. /etc/profile
如果 shell 是 bash,通常会调用它。例如,在我的/etc/profile
我有:
if [ "$PS1" ]; then
if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1=’0
if [ ?f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
fi
fi
Run Code Online (Sandbox Code Playgroud)
在使用方面,/etc/profile
为所有 Bourne 兼容的 shell(sh、bash、ksh 等)提供系统范围的配置。通常不需要等效的/etc/bash_profile
,因为配置文件的目的是控制登录外壳的行为。通常,您想做的任何事情都不会特定于 bash。/etc/bash.bashrc
是特定于 bash 的,并将为登录和非登录 shell 运行。
更复杂的是,看起来 OS X 甚至没有/etc/bash.bashrc
. 这可能与 OS X 中的 Terminals默认作为 login shell 运行的事实有关,因此区别丢失了:
终端窗口指南的一个例外是 Mac OS X 的 Terminal.app,它默认为每个新终端窗口运行一个登录 shell,调用 .bash_profile 而不是 .bashrc。其他 GUI 终端仿真器可能会做同样的事情,但大多数不会。
我不运行 OS X,所以我的知识范围到此为止。
归档时间: |
|
查看次数: |
74878 次 |
最近记录: |