Variables used by the Bourne shell
The shell uses the following variables. Although the shell sets some of them, you can set or reset all of them.
Item | Description |
---|---|
CDPATH | Specifies the search path for the cd (change directory) command. |
HOME | Indicates the name of your login directory, which is the directory that becomes the current directory upon completion of a login. The login program initializes this variable. The cd command uses the value of the $HOME variable as its default value. Using this variable rather than an explicit path name in a shell procedure allows the procedure to be run from a different directory without alterations. |
IFS | The characters that are IFS (internal field separators), which are the characters that the shell uses during blank interpretation. The shell initially sets the IFS variable to include the blank, tab, and newline characters. |
LANG | Determines the locale to use for the locale categories
when both the LC_ALL variable and the corresponding
environment variable (beginning with LC_ ) do not
specify a locale. |
LC_ALL | Determines the locale to be used to override any
values for locale categories specified by the settings of the LANG environment
variable or any environment variables beginning with LC_ . |
LC_COLLATE | Defines the collating sequence to use when sorting names and when character ranges occur in patterns. |
LC_CTYPE | Determines the locale for the interpretation of sequences of bytes of text data as characters (that is, single versus multibyte characters in arguments and input files), which characters are defined as letters (alpha character class), and the behavior of character classes within pattern matching. |
LC_MESSAGES | Determines the language in which messages should be written. |
LIBPATH | Specifies the search path for shared libraries. |
LOGNAME | Specifies your login name, marked readonly in
the /etc/profile file. |
Indicates the path name of the file used by the
mail system to detect the arrival of new mail. If this variable is
set, the shell periodically checks the modification time of this file
and displays the value of $MAILMSG if the time changes
and the length of the file is greater than 0. Set the MAIL variable
in the .profile file. The value normally assigned
to it by users of the mail command is /usr/spool/mail/$LOGNAME. |
|
MAILCHECK | The number of seconds that the shell lets elapse before checking again for the arrival of mail in the files specified by the MAILPATH or MAIL variables. The default value is 600 seconds (10 minutes). If you set the MAILCHECK variable to 0, the shell checks before each prompt. |
MAILMSG | The mail notification message. If you explicitly
set the MAILMSG variable to a null string (MAILMSG="" ),
no message is displayed. |
MAILPATH | A list of file names separated by colons. If this
variable is set, the shell informs you of the arrival of mail in any
of the files specified in the list. You can follow each file name
by a % and a message to be displayed when mail arrives.
Otherwise, the shell uses the value of the MAILMSG variable
or, by default, the message [YOU HAVE NEW MAIL] .Note: When
the MAILPATH variable is set, these files are checked
instead of the file set by the MAIL variable. To
check the files set by the MAILPATH variable and
the file set by the MAIL variable, specify the MAIL file
in your list of MAILPATH files.
|
PATH | The search path for commands, which is an ordered
list of directory path names separated by colons. The shell searches
these directories in the specified order when it looks for commands.
A null string anywhere in the list represents the current directory.
The PATH variable is normally initialized in the /etc/environment file, usually to /usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin. You can reset this variable to suit your own needs. The PATH variable provided in your .profile file also includes $HOME/bin and your current directory. If you have a project-specific directory
of commands, for example, /project/bin, that
you want searched before the standard system directories, set your PATH variable
as follows:
The best place to set your PATH variable to a value other than the default value is in your $HOME/.profile file. You cannot reset the PATH variable if you are executing commands under the restricted shell. |
PS1 | The string to be used as the primary system prompt.
An interactive shell displays this prompt string when it expects input.
The default value of the PS1 variable is $ followed
by a blank space for nonroot users. |
PS2 | The value of the secondary prompt string. If the
shell expects more input when it encounters a newline character in
its input, it prompts with the value of the PS2 variable.
The default value of the PS2 variable is > followed
by a blank space. |
SHACCT | The name of a file that you own. If this variable is set, the shell writes an accounting record in the file for each shell script executed. You can use accounting programs such as acctcom and acctcms to analyze the data collected. |
SHELL | The path name of the shell, which is kept in the environment. This variable should be set and exported by the $HOME/.profile file of each restricted login. |
TIMEOUT | The number of minutes a shell remains inactive before
it exits. If this variable is set to a value greater than zero (0),
the shell exits if a command is not entered within the prescribed
number of seconds after issuing the PS1 prompt. (Note
that the shell can be compiled with a maximum boundary that cannot
be exceeded for this value.) A value of zero indicates no time limit. |