Study of .bashrc, /etc/bashrc and Environment variables
The /etc/bashrc is executed for both interactive and non-interactive shells. /etc/bashrc or /etc/bash.bashrc is the systemwide bash per-interactive-shell startup file. Is is used system wide functions and aliases. However, environment stuff goes in /etc/profile file.the /etc/profile is executed only for interactive shells
.bashrc is a shell script that Bash runs whenever it is started interactively. It initializes an interactive shell session.
.bashrc runs on every interactive shell launch.
Following is the partial list of important environment variables :-
DISPLAY : Contains the identifier for the display that X11 programs should use by default.
HOME : Indicates the home directory of the current user: the default argument for the cd built-in command.
IFS : Indicates the Internal Field Separator that is used by the parser for word splitting after expansion.
LANG : LANG expands to the default system locale; LC_ALL can be used to override this. For example, if its value is pt_BR, then the language is set to (Brazilian) Portuguese and the locale to Brazil.
LD_LIBRARY_PATH : On many Unix systems with a dynamic linker, contains a colonseparated list of directories that the dynamic linker should search for shared objects when building a process image after exec, before searching in any other directories.
PATH : Indicates search path for commands. It is a colon-separated list of directories in which the shell looks for commands.
PWD : Indicates the current working directory as set by the cd command.
RANDOM : Generates a random integer between 0 and 32,767 each time it is referenced.
SHLVL : Increments by one each time an instance of bash is started. This variable is useful for determining whether the built-in exit command ends the current session.
TERM : Refers to the display type
VZ : Refers to Time zone. It can take values like GMT, AST, etc.
UID : Expands to the numeric user ID of the current user, initialized at shell startup.
For more JECRC University CSE-III Sem Linux Programming Lab Experiments Click Here