The .Profile File: "Unix Programming"
The .Profile File: "Unix Programming"
An important
Unix concept is the environment, which is defined by environment variables. Some
are set by the system, others by you, yet others by the shell, or any program that
loads another program.
A variable is a character string to which we assign a value. The value assigned
could be a number, text, filename, device, or any other type of data.
For example, first we set a variable TEST and then we access its value using
the echo command −
$TEST="Unix Programming"
$echo $TEST
/etc/profile
profile
The process is as follows −
The shell checks to see whether the file /etc/profile exists.
If it exists, the shell reads it. Otherwise, this file is skipped. No error message
is displayed.
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.
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 executed.
Note − The shell initialization process detailed here applies to all Bourne type
shells, but some additional files are used by bash and ksh.