ksh.1 (2010 09)

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
environments whose capabilities are more controlled than those of the standard shell. See Invoking ksh
and Special Commands sections later in this entry for details about command line options and argu-
ments, particularly the
set command.
Definitions
metacharacter
One of the following characters:
;&()|<>newline 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 amper-
sand (&) 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 follow-
ing it to be executed only if the preceding pipeline returns a zero (nonzero) value. An arbitrary number of
newlines 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.
HP-UX 11i Version 3: September 2010 1 Hewlett-Packard Company 1

Summary of content (26 pages)