DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

profile(4)


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(4)].

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(1)).

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(1), environ(5), login(1), mail(1), passwd(4), ksh88(1), ksh(1), sh(1), stty(1), su(1M), terminfo(4), timezone(4), tput(1)

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

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004