Command Reference Guide

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man1/!!!intro.1
________________________________________________________________
___ ___
k
ksh(1) ksh(1)
NAME
ksh, rksh - shell, the standard/restricted command programming language
SYNOPSIS
ksh [-aefhikmnoprstuvx][+aefhikmnoprstuvx][-o option ] ... [+o option ] ... [-c
string ][arg ...]
rksh [-aefhikmnoprstuvx][+aefhikmnoprstuvx][-o option ] ... [+o option ] ... [-c
string ][arg ...]
DESCRIPTION
ksh is a command programming language that executes commands read from a terminal or a file. rksh
is a restricted version of the command interpreter ksh, used to set up login names and execution environ-
ments whose capabilities are more controlled than those of the standard shell. See Invoking ksh and Spe-
cial Commands sections later in this entry for details about command line options and arguments, particu-
larly the set command.
Definitions
metacharacter
One of the following characters:
;&()|<>new-line space tab
blank A tab or space character.
identifier A sequence of letters, digits, or underscores starting with a letter or underscore. Identifiers
are used as names for functions and named parameters.
word A sequence of characters separated by one or more non-quoted metacharacters .
command A sequence of characters in the syntax of the shell language. The shell reads each com-
mand and carries out the desired action, either directly or by invoking separate utilities.
special command
A command that is carried out by the shell without creating a separate process. Often
called ‘‘built-in commands’’. Except for documented side effects, most special commands
can be implemented as separate utilities.
# The # character is interpreted as the beginning of a comment. See Quoting below.
Commands
A simple-command is a sequence of blank-separated words that can be preceded by a parameter assign-
ment list. (See Environment below). The first word specifies the name of the command to be executed.
Except as specified below, the remaining words are passed as arguments to the invoked command. The
command name is passed as argument 0 (see exec(2)). The value of a simple-command is its exit status if
it terminates normally, or (octal) 200+status if it terminates abnormally (see signal(5) for a list of status
values).
A pipeline is a sequence of one or more commands separated by
|. The standard output of each com-
mand except the last is connected by a pipe (see pipe(2)) to the standard input of the next command. Each
command is run as a separate process; the shell waits for the last command to terminate. The exit status
of a pipeline is the exit status of the last command in the pipeline.
A list is a sequence of one or more pipelines separated by ;, &, &&
,or||, and optionally terminated by ;,
&,or|&. Of these five symbols, ;, &, and |& have equal precedence.
&& and || have a higher but also
equal precedence. A semicolon (
;) causes sequential execution of the preceding pipeline; an ampersand (
&)
causes asynchronous execution of the preceding pipeline (that is, the shell does not wait for that pipeline to
finish). The symbol
|& causes asynchronous execution of the preceding command or pipeline with a two-
way pipe established to the parent shell (known as a co-process). The standard input and output of the
spawned command can be written to and read from by the parent shell using the -p option of the special
commands read and print described later. The symbol && (||) causes the list following it to be exe-
cuted only if the preceding pipeline returns a zero (non-zero) value. An arbitrary number of new-lines can
appear in a list, instead of semicolons, to delimit commands.
A command is either a simple-command or one of the following. Unless otherwise stated, the value
returned by a command is that of the last simple-command executed in the command.
Section 1396 1 HP-UX Release 11i: December 2000
___
___