Learning the Korn Shell

Learning the Korn ShellSearch this book
Previous: B.2 Built-in Commands and KeywordsAppendix B
Reference Lists
Next: B.4 Test Operators

B.3 Built-in Shell Variables

#4Number of arguments given to current process.
-Options given to shell on invocation.
?5Exit status of previous command.
$8Process ID of shell process.
_Last argument to previous command.
!8Process ID of last background command.
CDPATH3List of directories for cd command to search.

Width of display in columns (for editing modes and select).


Used to set editing mode; also used by mail and other programs.

ERRNOAError number of last system call that failed.

Name of file to run as environment file when shell is invoked.

FCEDIT2Default editor for fc command.
FPATH4Search path for autoloaded functions.

Internal field separator: list of characters that act as word separators. Normally set to SPACE, TAB, and NEWLINE.

HISTFILE2Name of command history file.
HISTSIZE2Number of lines kept in history file.
HOME3Home (login) directory.
LINENO9Number of line in script or function that just ran.
LINES3Height of display in lines (for select command).
MAIL3Name of file to check for new mail.
MAILCHECK3How often (in seconds) to check for new mail.

List of file names to check for new mail, if MAIL is not set.

OLDPWD3Previous working directory.
OPTARG6Argument to option being processed by getopts.
OPTIND6Number of first argument after options.
PATH3Search path for commands.
PS13Primary command prompt string.
PS23Prompt string for line continuations.
PS35Prompt string for select command.
PS49Prompt string for xtrace option.
PPID8Process ID of parent process.
PWD3Current working directory.

Random number between 0 and 32767 (2215-1).


User's response to select command; result of read command if no variable names given.

SECONDS3Number of seconds since shell was invoked.
SHELL3Full pathname of shell.

If set to a positive integer, number of seconds between commands after which shell automatically terminates.

VISUAL2Used to set editing mode.

Previous: B.2 Built-in Commands and KeywordsLearning the Korn ShellNext: B.4 Test Operators
B.2 Built-in Commands and KeywordsBook IndexB.4 Test Operators

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System