Encontré que esos son .bash_profile , .bashrc , .bash_login , .profile .
¿Cuál es la secuencia de lectura entre ellos?
Respuesta aceptada:
Básicamente, si es un shell de inicio de sesión, obtiene /etc/profile luego .bash_profile . Si no es un shell de inicio de sesión, pero está en una terminal, obtiene /etc/bash.bashrc luego .bashrc .
Pero en realidad es mucho más complicado.
La forma en que leo la página del manual:
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
Es un shell de inicio de sesión cada vez que se ejecuta el shell como -bash (tenga en cuenta el signo menos) o con -l opción. Esto suele suceder cuando inicia sesión con el login (las consolas virtuales de Linux hacen esto), a través de ssh, o si su emulador de terminal tiene habilitada la opción "iniciar sesión".
Es un shell interactivo cada vez que la entrada estándar es una terminal, o bash se inició con -i opción. Tenga en cuenta que si el shell también es un shell de inicio de sesión, bash no comprueba si el shell es interactivo. Por este motivo, .bash_profile generalmente contiene código para fuente .bashrc , para que pueda compartir la misma configuración entre shells interactivos y de inicio de sesión.