The .profile script

The .profile Script

The .profile file can contain any commands and environment settings that a normal shell script can.

The values of all shell variables can be set in .profile. For example, if we wanted to set the current terminal type to VT220, we would insert the following environment variable definition into the .profile file:

TERM=vt220; export TERM

In this example, the TERM variable is created and the value vt220 assigned to it. At this point, the scope of the variable is just the .profile script itself. In order to ensure that the value is exported to shell proper, the export command should be used as shown.

Since many environment variables are set system-wide (such as the location of database files), each user will expect to have variables consistently set. One way to ensure that users are using the correct variables is to define the /etc/skel/profile.local file. This skeleton file contains variable definitions that will be copied to new users’ accounts when they are created with admintool or useradd.

Exercise 11-1  Check the environment variables that are set in your current shell.

Part I: Solaris 9 Operating Environment, Exam I