Environment is defined by environment variables.
Which are
set by:
·
The system
·
Some by you
·
Some by the shell
·
Any program that loads another program.
Environment
variables are set without using $ sign but while accessing them we use $sign as
prefix. These variables retain their values until we come out shell.
When you login to the system, the shell
undergoes a phase called initialization to set up various environments. This is
usually a two-step process that involves the shell reading the following files:
·
/etc/profile
·
profile
The process is as follows:
1.
The shell checks to see whether the file /etc/profile exists.
2. If it exists, the shell reads it.
Otherwise, this file is skipped. No error message is displayed.
3.
The shell checks to see whether the file .profile exists
in your home directory. Your home directory is the directory that you start out
in after you log in.
4. If it exists, the shell reads it;
otherwise, the shell skips it. No error message is displayed.
As soon as both of these files have
been read, the shell displays a prompt:
$
This is the prompt where you can enter
commands in order to have them execute.
Usually the type of terminal you are using is automatically configured
by either the login or getty programs. Sometimes,
the auto configuration process guesses your terminal incorrectly.
If your terminal is set incorrectly,
the output of commands might look strange, or you might not be able to interact
with the shell properly.
for more information http://www.tutorialspoint.com/unix/unix-environment.htm