home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Learning the Korn Shell

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

B.3 Built-in Shell Variables

Variable Chapter Meaning
# 4 Number of arguments given to current process.
- Options given to shell on invocation.
? 5 Exit status of previous command.
$ 8 Process ID of shell process.
_ Last argument to previous command.
! 8 Process ID of last background command.
CDPATH 3 List of directories for cd command to search.
COLUMNS 3

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

EDITOR 2

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

ERRNO A Error number of last system call that failed.
ENV 3

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

FCEDIT 2 Default editor for fc command.
FPATH 4 Search path for autoloaded functions.
IFS 7

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

HISTFILE 2 Name of command history file.
HISTSIZE 2 Number of lines kept in history file.
HOME 3 Home (login) directory.
LINENO 9 Number of line in script or function that just ran.
LINES 3 Height of display in lines (for select command).
MAIL 3 Name of file to check for new mail.
MAILCHECK 3 How often (in seconds) to check for new mail.
MAILPATH 3

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

OLDPWD 3 Previous working directory.
OPTARG 6 Argument to option being processed by getopts .
OPTIND 6 Number of first argument after options.
PATH 3 Search path for commands.
PS1 3 Primary command prompt string.
PS2 3 Prompt string for line continuations.
PS3 5 Prompt string for select command.
PS4 9 Prompt string for xtrace option.
PPID 8 Process ID of parent process.
PWD 3 Current working directory.
RANDOM 9

Random number between 0 and 32767 (2 215 -1).

REPLY 5,7

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

SECONDS 3 Number of seconds since shell was invoked.
SHELL 3 Full pathname of shell.
TMOUT 10

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

VISUAL 2 Used to set editing mode.


Previous: B.2 Built-in Commands and Keywords Learning the Korn Shell Next: B.4 Test Operators
B.2 Built-in Commands and Keywords Book Index B.4 Test Operators

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