DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

profile(F)


profile -- setting up an environment at login time

Synopsis

/etc/profile
$HOME/.profile

Description

The file /etc/profile contains shell commands that are executed at login time for any user whose entry in /etc/passwd has a shell specified in the shell field whose name ends in sh.

The /etc/profile file allows the system administrator to perform services for the entire user community.

The default /etc/profile performs the following routine tasks (among others):

It is also not unusual for /etc/profile to execute special actions for the root login or the su command.

Computers running outside the U.S. Eastern time zone should have the line

   . /etc/TIMEZONE
included early in /etc/profile [see timezone(F)].

X/Open execution environment

If a login's entry in the /etc/passwd file has the shell /u95/bin/sh in the shell field, then the following commands are executed from /etc/profile when the user logs in to the system:
   PATH=/u95/bin:$PATH
   POSIX2=on

This sets the logged in user's execution environment to conform to X/Open Interface Definitions, Version 4 Issue 2.

The PATH setting causes command searching to begin with /u95/bin so that any commands found there are executed rather than other versions found in standard directories appearing later in the PATH string. For example, entering sh on the command line with PATH set as above executes /u95/bin/sh rather than /usr/bin/sh (/u95/bin/sh is the version of the Korn Shell that complies with X/Open Interface Definitions, Version 4 Issue 2; see ksh(C)).

The setting of the POSIX2 environment variable changes the behavior of many standard commands to match the behavior specified in X/Open Interface Definitions, Version 4 Issue 2.

Files


/etc/TIMEZONE
timezone environment

$HOME/.profile
user-specific execution environment

/etc/passwd
login definitions

/etc/profile
system-wide execution environment

References

env(C), environ(M), login(C), mail(C), passwd(F), ksh88(C), ksh(C), sh(C), stty(C), su(ADM), terminfo(F), timezone(F), tput(C)

Notices

Care must be taken in providing system-wide services in /etc/profile. Personal .profile files are better for serving all but the most global needs.

Examples

The file $HOME/.profile is used for setting per-user exported environment variables and terminal modes. The following example is typical (except for the comments):
   # Make some environment variables global
   export MAIL PATH TERM
   # Set file creation mask
   umask 022
   # Tell me when new mail comes in
   MAIL=/var/mail/$LOGNAME
   # Add my bin directory to the shell search sequence
   PATH=$PATH:$HOME/bin
   # Set terminal type
   TERM=${L0:-u/n/k/n/o/w/n}
   while :
   do
   	if [ -f ${TERMINFO:-/usr/share/lib/terminfo}/?/$TERM ]
   	then break
   	elif [ -f /usr/share/lib/terminfo/?/$TERM ]
   	then break
   	else echo "invalid term $TERM" 1>&2
   	fi
   	echo "terminal: \c"
   	read TERM
   done
   # Set the erase character to backspace
   stty erase '^H' echoe

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 02 June 2005