Command Reference Guide

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man1/!!!intro.1
________________________________________________________________
___ ___
k
ksh(1) ksh(1)
command in the replaced text, other than any that are in the process of being replaced, is tested for addi-
tional aliases. If the last character of the alias value is a blank, the word following the alias is also checked
for alias substitution. Aliases can be used to redefine special built-in commands, but cannot be used to
redefine the keywords listed above. Aliases can be created, listed, and exported with the alias command
and can be removed with the unalias command. Exported aliases remain in effect for subshells but
must be reinitialized for separate invocations of the shell (see Invoking ksh below).
Aliasing is performed when scripts are read, not while they are executed. Therefore, for it to take effect,
alias must be executed before the command referring to the alias is read.
Aliases are frequently used as a shorthand for full path names. An option to the aliasing facility allows the
value of the alias to be automatically set to the full path name of the corresponding command. These
aliases are called tracked aliases. The value of a tracked alias is defined the first time the identifier is
read and becomes undefined each time the PATH variable is reset. These aliases remain tracked so that
the next reference redefines the value. Several tracked aliases are compiled into the shell. The -h option
of the set command converts each command name that is an identifier into a tracked alias.
The following exported aliases are compiled into the shell but can be unset or redefined:
autoload=’typeset -fu’
false=’let 0’
functions=’typeset -f’
hash=’alias -t -’
history=’fc -l’
integer=’typeset -i’
nohup=’nohup ’
r=’fc -e -’
stop=’kill -STOP’
suspend=’kill -STOP $$’
true=’:’
type=’whence -v’
Tilde Substitution
After alias substitutionis performed, each word is checked to see if it begins with an unquoted ˜
. If it does,
the word up to a
/ is checked to see if it matches a user name in the
/etc/passwd file. If a match is
found, the
˜ and the matched login name are replaced by the login directory of the matched user. This is
called a tilde substitution. If no match is found, the original text is left unchanged. A
˜, alone or before a
/, is replaced by the value of the HOME parameter. A ˜ followed by a + or
- is replaced by the value of
the parameter
PWD and OLDPWD, respectively. In addition, tilde substitutionis attempted when the value
of a parameter assignment begins with a ˜.
Command Substitution
The standard output from a command enclosed in parenthesis preceded by a dollar sign ($(command) )
or a pair of back single quotes (accent grave) (`command` ) can be used as part or all of a word; trailing
new-lines are removed. In the second (archaic) form, the string between the quotes is processed for special
quoting characters before the command is executed (see Quoting below). The command substitution
$(cat file) can be replaced by the equivalent but faster $(<file). Command substitution of most
special commands (built-ins) that do not perform I/O redirection are carried out without creating a separate
process. However, command substitution of a function creates a separate process to execute the function
and all commands (built-in or otherwise) in that function.
An arithmetic expression enclosed in double parenthesis preceded by a dollar sign ($((expression)))is
replaced by the value of the arithmetic expression within the double parenthesis (see Arithmetic Evaluation
below for a description of arithmetic expressions).
Parameter Substitution
A parameter is an identifier, one or more digits, or any of the characters
*, @, #, ?, -, $, and !.A
named parameter (a parameter denoted by an identifier) has a value and zero or more attributes. Named
parameters can be assigned values and attributes by using the
typeset special command. Attributes
supported by ksh are described later with the typeset special command. Exported parameters pass
values and attributes to the environment.
The shell supports a limited one-dimensional array facility. An element of an array parameter is refer-
enced by a subscript. A subscript is denoted by a [ followed by an arithmetic expression (see Arithmetic
Evaluation below) followed by a
]. To assign values to an array, use set -A
name value .... The value
Section 1−−398 − 3 − HP-UX Release 11i: December 2000
___
___