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 ®le. 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 arguments, particularly the set command.

De®nitions 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. Identi®ers

 

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-commandis a sequence of blank-separated words that can be preceded by a parameter assignment list. (See Environment below). The ®rst word speci®es the name of the command to be executed. Except as speci®ed 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 command 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 ®ve 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 ®nish). 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 -poption of the special commands read and print described later. The symbol && ( ) causes the list following it to be executed 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