全部博文(42)
分类: LINUX
2010-08-30 16:44:37
Startup files are scripts that are read and executed by Bash when it starts. The following subsections describe different ways to start the shell, and the startup files that are read consequently.
Interactive means you can enter commands. The shell is not running because a script has been activated. A login shell means that you got the shell after authenticating to the system, usually by giving your user name and password.
Files read:
/etc/profile
~/.bash_profile, ~/.bash_login or ~/.profile: first existing readable file is read
~/.bash_logout upon logout.
Error messages are printed if configuration files exist but are not readable. If a file does not exist, bash searches for the next.
A non-login shell means that you did not have to authenticate to the system. For instance, when you open a terminal using an icon, or a menu item, that is a non-login shell.
Files read:
~/.bashrc
This file is usually referred to in ~/.bash_profile:
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi