I found that those are
What's the reading sequence between them?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
Basically, if it's a login shell it sources
.bash_profile. If it's not a login shell, but you're at a terminal, it sources
But it's actually a lot more complicated.
The way I read the man page:
if bash_mode; then if login_shell; then if test -e /etc/profile; then source /etc/profile; fi if test -e .bash_profile; then source .bash_profile elif test -e .bash_login; then source .bash_login elif test -e .profile; then source .profile; fi elif interactive_shell || remote_shell; then if test -e /etc/bash.bashrc; then source /etc/bash.bashrc if test -e .bashrc; then source .bashrc; fi elif test -n "$BASH_ENV"; then source "$BASH_ENV" fi elif sh_mode; then if login_shell; then if test -e /etc/profile; then source /etc/profile; fi if test -e .profile; then source .profile; fi elif interactive_shell; then if test -n "$ENV"; then source "$ENV" fi fi fi
It's a login shell any time the shell is run as
-bash (note the minus sign) or with the
-l option. This usually happens when you log in using the
login command (Linux virtual consoles do this), over ssh, or if your terminal emulator has the "login shell" option enabled.
It's an interactive shell any time standard input is a terminal, or bash was started with the
-i option. Note that if the shell is also a login shell, bash doesn't check if the shell is interactive. For this reason,
.bash_profile usually contains code to source
.bashrc, so you can share the same settings between interactive and login shells.