k

ksh(1)

ksh(1)

The following parameters are set automatically by the shell:

#The number of positional parameters in decimal.

-Options supplied to the shell on invocation or by the set command.

? The decimal value returned by the last executed command.

$

The process number of this shell.

_

Initially, the value of _ is an absolute pathname of the shell or script being executed

 

as passed in the environment. Subsequently it is assigned the last argument of the

 

previous command. This parameter is not set for commands which are asynchronous.

 

This parameter is also used to hold the name of the matching MAIL ®le when check-

 

ing for mail.

!The process number of the last background command invoked.

COLUMNS

If this variable is set, its value is used to de®ne the width of the edit window for the

 

shell edit modes and for printing select lists. In a windowed environment, if the

 

shell detects that the window size has changed, the shell updates the value of

 

COLUMNS.

 

ERRNO

The value of errno as set by the most recently failed system call. This value is sys-

 

tem dependent and is intended for debugging purposes.

 

LINENO

The line number of the current line within the script or function being executed.

LINES

If this variable is set, the value is used to determine the column length for printing

 

select lists. select lists print vertically until about two-thirds of LINES lines

 

are ®lled. In a windowed environment, if the shell detects that the window size has

 

changed, the shell updates the value of LINES.

 

OLDPWD

The previous working directory set by the cd command.

OPTARG

The value of the last option argument processed by the

getopts special command.

OPTIND

The index of the last option argument processed by the

getopts special command.

PPID

The process number of the parent of the shell.

 

PWD

The present working directory set by the cd command.

 

RANDOM

Each time this parameter is evaluated, a random integer, uniformly distributed

 

between 0 and 32767, is generated. The sequence of random numbers can be initial-

 

ized by assigning a numeric value to RANDOM.

 

REPLY

This parameter is set by the select statement and by the read special command

 

when no arguments are supplied.

 

SECONDS

Each time this parameter is referenced, the number of seconds since shell invocation

 

is returned. If this parameter is assigned a value, the value returned upon reference

 

is the value that was assigned plus the number of seconds since the assignment.

The following parameters are used by the shell:

CDPATH

The search path for the

cd command.

 

 

 

EDITOR

If the value of this variable ends in emacs, gmacs, or vi and the VISUAL variable

 

is not set, the corresponding option is turned on (see

set in Special Commands

 

below).

 

 

 

 

ENV

If this parameter is set, parameter substitution is performed on the value to generate

 

the path name of the script to be executed when the shell is invoked (see Invoking ksh

 

below). This ®le is typically used for alias and function de®nitions.

 

FCEDIT

The default editor name for the fc command.

 

 

 

FPATH

The search path for function de®nitions. This path is searched when a function with

 

the

-uattribute is referenced and when a command is not found. If an executable

 

®le is found, then it is read and executed in the current environment.

 

IFS

Internal ®eld separators, normally space, tab, and new-linethat are used to separate

 

command words resulting from command or parameter substitution, and for separat-

 

ing words with the special command read. The ®rst character of the IFS parame-

 

ter is used to separate arguments for the "$*" substitution (see Quoting below).

HISTFILE

If this parameter is set when the shell is invoked, its value is the path name of the ®le

 

that

is used to

store the command

history.

The default

value is

 

$HOME/.sh_history. If the user has appropriate privileges and no

HISTFILE

 

is given, then no history ®le is used (see Command Re-entrybelow).

 

HISTSIZE

If this parameter is set when the shell is invoked, the number of previously entered

 

commands accessible to this shell will be greater than or equal to this number. The

 

default is 128.

 

 

 

 

HOME

The default argument (home directory) for the

cd command.

 

Section 1400

 

 

− 5 −

HP-UX Release 11i: December 2000