man ksh Command

Man page for apt-get ksh Command

Man Page for ksh in Linux

Ubuntu Man Command : man ksh

Man Ksh  Command

This tutorial shows the man page for man ksh in linux.

Open terminal with 'su' access and type the command as shown below:
man ksh

Result of the Command Execution shown below:

KSH(1)                                                                                                                                                        KSH(1)



NAME
ksh, ksh93 KornShell, a command and programming language

SYNOPSIS
ksh [ ±abcefhikmnoprstuvxBCDP ] [ R file ] [ ±o option ] ... [ ] [ arg ... ]
rksh [ ±abcefhikmnoprstuvxBCD ] [ R file ] [ ±o option ] ... [ ] [ arg ... ]

DESCRIPTION
Ksh is a command and programming language that executes commands read from a terminal or a file. Rksh is a restricted version of the command interpreter
ksh; it is used to set up login names and execution environments whose capabilities are more controlled than those of the standard shell. Rpfksh is a pro Äê
file shell version of the command interpreter ksh; it is used to to execute commands with the attributes specified by the user's profiles (see pfexec(1)).
See Invocation below for the meaning of arguments to the shell.

Definitions.
A metacharacter is one of the following characters:

; & ( )  é"! < > new line space tab

A blank is a tab or a space. An identifier is a sequence of letters, digits, or underscores starting with a letter or underscore. Identifiers are used as
components of variable names. A vname is a sequence of one or more identifiers separated by a . and optionally preceded by a .. Vnames are used as function
and variable names. A word is a sequence of characters from the character set defined by the current locale, excluding non quoted metacharacters.

A command is a sequence of characters in the syntax of the shell language. The shell reads each command and carries out the desired action either directly
or by invoking separate utilities. A built in command is a command that is carried out by the shell itself without creating a separate process. Some com Äê
mands are built in purely for convenience and are not documented here. Built ins that cause side effects in the shell environment and built ins that are
found before performing a path search (see Execution below) are documented here. For historical reasons, some of these built ins behave differently than
other built ins and are called special built ins.

Commands.
A simple command is a list of variable assignments (see Variable Assignments below) or a sequence of blank separated words which may be preceded by a list of
variable assignments (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; 0 255 if it terminates normally; 256+signum if it terminates abnormally (the name of the signal corresponding to the exit status can be obtained via
the l option of the kill built in utility).

A pipeline is a sequence of one or more commands separated by  é"!. The standard output of each command but the last is connected by a pipe(2) to the standard
input of the next command. Each command, except possibly the last, 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 unless the pipefail option is enabled. Each pipeline can be preceded by the reserved word !
which causes the exit status of the pipeline to become 0 if the exit status of the last command is non zero, and 1 if the exit status of the last command is
0.

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, which is lower than that of & and  é"! é"!. The symbols & and  é"! é"! also have equal precedence. A semicolon (;) causes sequential execu Äê
tion of the preceding pipeline; an ampersand (&) causes asynchronous execution of the preceding pipeline (i.e., the shell does not wait for that pipeline to
finish). The symbol  é"!& causes asynchronous execution of the preceding pipeline with a two way pipe established to the parent shell; the standard input and
output of the spawned pipeline can be written to and read from by the parent shell by applying the redirection operators <& and >& with arg p to commands and
by using p option of the built in commands read and print described later. The symbol & ( é"! é"!) causes the list following it to be executed only if the pre Äê
ceding pipeline returns a zero (non zero) value. One or more new lines may appear in a list instead of a semicolon, to delimit a command. The first item
of the first pipeline of a list that is a simple command not beginning with a redirection, and not occurring within a while, until, or if list, can be pre Äê
ceded by a semicolon. This semicolon is ignored unless the showme option is enabled as described with the set built in below.

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.

for vname [ in word ... ] ;do list ;done
Each time a for command is executed, vname is set to the next word taken from the in word list. If in word ... is omitted, then the for command exe Äê
cutes the do list once for each positional parameter that is set starting from 1 (see Parameter Expansion below). Execution ends when there are no
more words in the list.

for (( [expr1] ; [expr2] ; [expr3] )) ;do list ;done
The arithmetic expression expr1 is evaluated first (see Arithmetic evaluation below). The arithmetic expression expr2 is repeatedly evaluated until
it evaluates to zero and when non zero, list is executed and the arithmetic expression expr3 evaluated. If any expression is omitted, then it behaves
as if it evaluated to 1.

select vname [ in word ... ] ;do list ;done
A select command prints on standard error (file descriptor 2) the set of words, each preceded by a number. If in word ... is omitted, then the posi Äê
tional parameters starting from 1 are used instead (see Parameter Expansion below). The PS3 prompt is printed and a line is read from the standard
input. If this line consists of the number of one of the listed words, then the value of the variable vname is set to the word corresponding to this
number. If this line is empty, the selection list is printed again. Otherwise the value of the variable vname is set to null. The contents of the
line read from standard input is saved in the variable REPLY. The list is executed for each selection until a break or end of file is encountered.
If the REPLY variable is set to null by the execution of list, then the selection list is printed before displaying the PS3 prompt for the next selec Äê
tion.

case word in [ [(]pattern [  é"! pattern ] ... ) list ;; ] ... esac
A case command executes the list associated with the first pattern that matches word. The form of the patterns is the same as that used for file name
generation (see File Name Generation below). The ;; operator causes execution of case to terminate. If ;& is used in place of ;; the next subsequent
list, if any, is executed.

if list ;then list [ ;elif list ;then list ] ... [ ;else list ] ;fi
The list following if is executed and, if it returns a zero exit status, the list following the first then is executed. Otherwise, the list following
elif is executed and, if its value is zero, the list following the next then is executed. Failing each successive elif list, the else list is exe Äê
cuted. If the if list has non zero exit status and there is no else list, then the if command returns a zero exit status.

while list ;do list ;done
until list ;do list ;done
A while command repeatedly executes the while list and, if the exit status of the last command in the list is zero, executes the do list; otherwise
the loop terminates. If no commands in the do list are executed, then the while command returns a zero exit status; until may be used in place of
while to negate the loop termination test.

((expression))
The expression is evaluated using the rules for arithmetic evaluation described below. If the value of the arithmetic expression is non zero, the
exit status is 0, otherwise the exit status is 1.

(list)
Execute list in a separate environment. Note, that if two adjacent open parentheses are needed for nesting, a space must be inserted to avoid evalua Äê
tion as an arithmetic command as described above.

{ list;}
list is simply executed. Note that unlike the metacharacters ( and ), { and } are reserved words and must occur at the beginning of a line or after a
; in order to be recognized.

[[ expression ]]
Evaluates expression and returns a zero exit status when expression is true. See Conditional Expressions below, for a description of expression.

function varname { list ;}
varname () { list ;}
Define a function which is referenced by varname. A function whose varname contains a . is called a discipline function and the portion of the var Äê
name preceding the last . must refer to an existing variable. The body of the function is the list of commands between { and }. A function defined
with the function varname syntax can also be used as an argument to the . special built in command to get the equivalent behavior as if the varname()
syntax were used to define it. (See Functions below.)

time [ pipeline ]
If pipeline is omitted the user and system time for the current shell and completed child processes is printed on standard error. Otherwise, pipeline
is executed and the elapsed time as well as the user and system time are printed on standard error. The TIMEFORMAT variable may be set to a format
string that specifies how the timing information should be displayed. See Shell Variables below for a description of the TIMEFORMAT variable.

The following reserved words are recognized as reserved only when they are the first word of a command and are not quoted:

if then else elif fi case esac for while until do done { } function select time [[ ]] !

Variable Assignments.
One or more variable assignments can start a simple command or can be arguments to the typeset, enum, export, or readonly special built in commands as well
as to other declaration commands created as types. The syntax for an assignment is of the form:

varname=word
varname[word]=word
No space is permitted between varname and the = or between = and word.

varname=(assign_list)
No space is permitted between varname and the =. An assign_list can be one of the following:
word ...
Indexed array assignment.
[word]=word ...
Associative array assignment. If preceded by typeset a this will create an indexed array instead.
assignment ...
Compound variable assignment. This creates a compound variable varname with sub variables of the form varname.name, where name is the
name portion of assignment. The value of varname will contain all the assignment elements. Additional assignments made to sub vari Äê
ables of varname will also be displayed as part of the value of varname. If no assignments are specified, varname will be a compound
variable allowing subsequence child elements to be defined.
typeset [options] assignment ...
Nested variable assignment. Multiple assignments can be specified by separating each of them with a ;. The previous value is unset
before the assignment. Other declaration commands such as readonly, enum, and other declaration commands can be used in place of type Äê
set.
. filename
Include the assignment commands contained in filename.

In addition, a += can be used in place of the = to signify adding to or appending to the previous value. When += is applied to an arithmetic type, word is
evaluated as an arithmetic expression and added to the current value. When applied to a string variable, the value defined by word is appended to the value.
For compound assignments, the previous value is not unset and the new values are appended to the current ones provided that the types are compatible.

The right hand side of a variable assignment undergoes all the expansion list below except word splitting, brace expansion, and file name generation. When
the left hand side is an assignment is a compound variable and the right hand is the name of a compound variable, the compound variable on the right will be
copied or appended to the compound variable on the left.

Comments.
A word beginning with


Related Topics

Apt Get Commands