Shells
The logon shell, which is assigned by the system as a part of
creating a user account, determines which initialization files
are read during logon.
Bourne
Shell
The
command sh opens
a Bourne subshell. To set the user's environment, the Bourne shell
uses .bash_profile,
a user-specific initialization file The .bash_profile
file is only read once during logon.
Bash
Shell
The
command sh opens
a Bash shell, which uses two user-enviornment files to set the
user's enviornment: .bashrc
and .bash_profile.
The
.profile file is read when you log in to the system. Then, if
the ENV variable
in the .bash_profile
file is assigned and exported, the .bashrc
file is read. The .profile
file is only read once, but the .bashrc
file is read every time a new Bash shell is opened.
Because
many of the Bash shell commands that the user places in the
.bashrc file
cannot be executed by the Bourne shell, they should not be placed
in the .bash_profile
file.