2013年7月23日 星期二

bash_profile vs bashrc vs profile, environment variables

.bash_profile --> login shell

.bashrc --> non-login shell

login shell:
e.g. login via console, ssh

non-login shell:
e.g. new terminal windows in inside GNOME ( already logged in)
/bin/bash in terminal

When bash is invoked as an interactive login shell, or as a non-interac-
tive 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.

/etc/profile --> ~/.bash_profile > ~/.bash_login > ~/.profile

Environment Variable

/etc/environment - This file is specifically meant for system-wide environment variable settings. It is not a script file, but rather consists of assignment expressions, one per line. Specifically, this file stores the system-wide locale and path settings.


set -- show environment variables + shell variables

env -- show environment variables


沒有留言:

張貼留言