給我秘密留言(用gpg加密的,你可放心)

20070326

bashrc 與 bash_profile的區別

/etc/profile 是系統每個使用者預設的 profile,在第一次執行時,由/etc/profile.d找出shell的設定

/etc/bashrc系統每個使用者預設的rc,當使用bash shell時,讀取此文件

~/.bashprofile 每個使用者在登入時,所讀取的

~/.bashrc 每次打開新的 bash shell時使用

~/.bash_logout 登出時,



~/.bash_profile 是交互式、login 方式进入 bash 运行的

~/.bashrc 是交互式 non-login 方式进入 bash 运行的

通常二者设置大致相同,所以通常前者会调用后者。




When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.


...


When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if these files exist. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of /etc/bash.bashrc and ~/.bashrc.



http://www.linuxquestions.org/questions/history/273992

沒有留言: