ksh.1 (2010 09)
k
ksh(1) ksh(1)
echo ${d:-$(pwd)}
If the colon (:) is omitted from the above expressions, the shell only checks to determine whether or
not parameter is set.
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 exe-
cuted 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 asyn-
chronous. This parameter is also used to hold the name of the matching
MAIL file
when checking for mail.
! The process number of the last background command invoked.
COLUMNS If this variable is set, its value is used to define 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
system 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 filled. 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 com-
mand.
OPTIND The index of the last option argument processed by the getopts special com-
mand.
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 ini-
tialized by assigning a numeric value to RANDOM.
REPLY This parameter is set by the select statement and by the read special com-
mand when no arguments are supplied.
SECONDS Each time this parameter is referenced, the number of seconds since shell invoca-
tion 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 vari-
able is not set, the corresponding option is turned on (see set in Special Com-
mands below).
ENV If this parameter is set, parameter substitution is performed on the value to gen-
erate the path name of the script to be executed when the shell is invoked (see
Invoking ksh below). This file is typically used for alias and function definitions.
HP-UX 11i Version 3: September 2010 − 5 − Hewlett-Packard Company 5