1KSH(1)                      General Commands Manual                     KSH(1)
2
3
4

NAME

6       ksh,  rksh,  pfksh  - KornShell, a standard/restricted command and pro‐
7       gramming language
8

SYNOPSIS

10       ksh [ ±abcefhiknoprstuvxBCDP ] [ -R file ] [ ±o option ] ... [  -  ]  [
11       arg ... ]
12

DESCRIPTION

14       Ksh  is  a command and programming language that executes commands read
15       from a terminal or a file.  Rksh is a restricted version of the command
16       interpreter  ksh;  it is used to set up login names and execution envi‐
17       ronments whose capabilities are more controlled than those of the stan‐
18       dard  shell.   Rpfksh  is a profile shell version of the command inter‐
19       preter ksh; it is used to to execute commands with the attributes spec‐
20       ified by the user's profiles (see pfexec(1)).  See Invocation below for
21       the meaning of arguments to the shell.
22
23   Definitions.
24       A metacharacter is one of the following characters:
25
26              ;   &   (   )   ⎪   <   >   new-line   space   tab
27
28       A blank is a tab or a space.  An identifier is a sequence  of  letters,
29       digits,  or  underscores starting with a letter or underscore.  Identi‐
30       fiers are used as components of variable names.  A vname is a  sequence
31       of  one or more identifiers separated by a . and optionally preceded by
32       a ..  Vnames are used as function and variable  names.   A  word  is  a
33       sequence  of  characters  from the character set defined by the current
34       locale, excluding non-quoted metacharacters.
35
36       A command is a sequence of characters in the syntax of the  shell  lan‐
37       guage.  The shell reads each command and carries out the desired action
38       either directly or by invoking separate utilities.  A built-in  command
39       is a command that is carried out by the shell itself without creating a
40       separate process.  Some commands are built-in  purely  for  convenience
41       and  are not documented here.  Built-ins that cause side effects in the
42       shell environment and built-ins that are found before performing a path
43       search  (see Execution below) are documented here.  For historical rea‐
44       sons, some of these built-ins behave differently than  other  built-ins
45       and are called special built-ins.
46
47   Commands.
48       A  simple-command  is  a  list  of  variable  assignments (see Variable
49       Assignments below) or a sequence of blank separated words which may  be
50       preceded  by  a  list  of variable assignments (see Environment below).
51       The first word specifies the  name  of  the  command  to  be  executed.
52       Except  as specified below, the remaining words are passed as arguments
53       to the invoked command.  The command name is passed as argument 0  (see
54       exec(2)).   The  value of a simple-command is its exit status; 0-255 if
55       it terminates normally; 256+signum if  it  terminates  abnormally  (the
56       name of the signal corresponding to the exit status can be obtained via
57       the -l option of the kill built-in utility).
58
59       A pipeline is a sequence of one or more commands separated by  .   The
60       standard  output of each command but the last is connected by a pipe(2)
61       to the standard input of the next command.  Each command, except possi‐
62       bly  the  last,  is  run as a separate process; the shell waits for the
63       last command to terminate.  The exit status of a pipeline is  the  exit
64       status of the last command unless the pipefail option is enabled.  Each
65       pipeline can be preceded by the reserved word !  which causes the  exit
66       status  of the pipeline to become 0 if the exit status of the last com‐
67       mand is non-zero, and 1 if the exit status of the last command is 0.
68
69       A list is a sequence of one or more pipelines separated by  ;,  &,  ⎪&,
70       &&,  or  ⎪⎪,  and  optionally terminated by ;, &, or ⎪&.  Of these five
71       symbols, ;, &, and ⎪& have equal precedence, which is lower  than  that
72       of  &&  and  ⎪⎪.   The symbols && and ⎪⎪ also have equal precedence.  A
73       semicolon (;) causes sequential execution of the preceding pipeline; an
74       ampersand  (&)  causes asynchronous execution of the preceding pipeline
75       (i.e., the shell does not wait for that pipeline to finish).  The  sym‐
76       bol  ⎪&  causes asynchronous execution of the preceding pipeline with a
77       two-way pipe established to the parent shell; the  standard  input  and
78       output  of  the spawned pipeline can be written to and read from by the
79       parent shell by applying the redirection operators <& and >& with arg p
80       to  commands  and  by using -p option of the built-in commands read and
81       print described later.  The symbol && (⎪⎪) causes the list following it
82       to be executed only if the preceding pipeline returns a zero (non-zero)
83       value.  One or more new-lines may appear in a list instead of  a  semi‐
84       colon,  to delimit a command.  The first item  of the first pipeline of
85       a list that is a simple command not beginning with a  redirection,  and
86       not  occurring  within a while, until, or if list, can be preceded by a
87       semicolon.  This semicolon is  ignored  unless  the  showme  option  is
88       enabled as described with the set built-in below.
89
90       A  command  is either a simple-command or one of the following.  Unless
91       otherwise stated, the value returned by a command is that of  the  last
92       simple-command executed in the command.
93
94       for vname [ in word ... ] ;do list ;done
95              Each  time  a  for command is executed, vname is set to the next
96              word taken from the in word list.  If in word ...   is  omitted,
97              then  the  for  command executes the do list once for each posi‐
98              tional parameter that is set  starting  from  1  (see  Parameter
99              Expansion  below).   Execution ends when there are no more words
100              in the list.
101
102       for (( [expr1] ; [expr2] ; [expr3] )) ;do list ;done
103              The arithmetic expression expr1 is evaluated first  (see  Arith‐
104              metic  evaluation  below).   The  arithmetic expression expr2 is
105              repeatedly evaluated until it evaluates to zero  and  when  non-
106              zero, list is executed and the arithmetic expression expr3 eval‐
107              uated.  If any expression is omitted, then it behaves as  if  it
108              evaluated to 1.
109
110       select vname [ in word ... ] ;do list ;done
111              A  select  command  prints on standard error (file descriptor 2)
112              the set of words, each preceded by a number.  If in word ...  is
113              omitted, then the positional parameters starting from 1 are used
114              instead (see Parameter Expansion  below).   The  PS3  prompt  is
115              printed  and  a  line  is read from the standard input.  If this
116              line consists of the number of one of the listed words, then the
117              value  of the variable vname is set to the word corresponding to
118              this number.  If this line  is  empty,  the  selection  list  is
119              printed again.  Otherwise the value of the variable vname is set
120              to null.  The contents of the line read from standard  input  is
121              saved  in  the  variable  REPLY.   The list is executed for each
122              selection until a break or end-of-file is encountered.   If  the
123              REPLY variable is set to null by the execution of list, then the
124              selection list is printed before displaying the PS3  prompt  for
125              the next selection.
126
127       case word in [ [(]pattern [ ⎪ pattern ] ... ) list ;; ] ... esac
128              A  case command executes the list associated with the first pat‐
129              tern that matches word.  The form of the patterns is the same as
130              that  used  for  file-name  generation (see File Name Generation
131              below).  The ;; operator causes execution of case to  terminate.
132              If  ;&  is used in place of ;; the next subsequent list, if any,
133              is executed.
134
135       if list ;then list [ ;elif list ;then list ] ... [ ;else list ] ;fi
136              The list following if is executed and, if it returns a zero exit
137              status,  the  list following the first then is executed.  Other‐
138              wise, the list following elif is executed and, if its  value  is
139              zero,  the  list  following  the next then is executed.  Failing
140              each successive elif list, the else list is executed.  If the if
141              list  has  non-zero  exit status and there is no else list, then
142              the if command returns a zero exit status.
143
144       while list ;do list ;done
145       until list ;do list ;done
146              A while command repeatedly executes the while list and,  if  the
147              exit  status  of  the last command in the list is zero, executes
148              the do list; otherwise the loop terminates.  If no  commands  in
149              the  do list are executed, then the while command returns a zero
150              exit status; until may be used in place of while to  negate  the
151              loop termination test.
152
153       ((expression))
154              The expression is evaluated using the rules for arithmetic eval‐
155              uation described below.  If the value of the arithmetic  expres‐
156              sion  is non-zero, the exit status is 0, otherwise the exit sta‐
157              tus is 1.
158
159       (list)
160              Execute list in a separate environment.  Note, that if two adja‐
161              cent  open  parentheses  are needed for nesting, a space must be
162              inserted  to  avoid  evaluation  as  an  arithmetic  command  as
163              described above.
164
165       { list;}
166              list  is simply executed.  Note that unlike the metacharacters (
167              and ), { and } are reserved words and must occur at  the  begin‐
168              ning of a line or after a ; in order to be recognized.
169
170       [[ expression ]]
171              Evaluates expression and returns a zero exit status when expres‐
172              sion is true.  See Conditional Expressions below, for a descrip‐
173              tion of expression.
174
175       function varname { list ;}
176       varname () { list ;}
177              Define  a  function  which is referenced by varname.  A function
178              whose varname contains a .  is called a discipline function  and
179              the  portion  of the varname preceding the last .  must refer to
180              an existing variable.  The body of the function is the  list  of
181              commands  between { and }.  A function defined with the function
182              varname syntax can also be used as an argument to the .  special
183              built-in  command  to get the equivalent behavior as if the var‐
184              name() syntax were used to define it.  (See Functions below.)
185
186       namespace identifier { list ;}
187              Defines or uses the name space identifier and runs the  commands
188              in list in this name space.  (See Name Spaces below.)
189
190       & [ name [ arg... ]  ]
191              Causes  subsequent list commands terminated by & to be placed in
192              the background job pool name.  If  name  is  omitted  a  default
193              unnamed  pool  is used.  Commands in a named background pool may
194              be executed remotely.
195
196       time [ pipeline ]
197              If pipeline is omitted the user and system time for the  current
198              shell  and  completed  child  processes  is  printed on standard
199              error.  Otherwise, pipeline is executed and the elapsed time  as
200              well  as the user and system time are printed on standard error.
201              The TIMEFORMAT variable may be set to a format string that spec‐
202              ifies how the timing information should be displayed.  See Shell
203              Variables below for a description of the TIMEFORMAT variable.
204
205       The following reserved words are recognized as reserved only when  they
206       are the first word of a command and are not quoted:
207
208       if  then  else  elif  fi case esac for while until do done { } function
209       select time [[ ]] !
210
211   Variable Assignments.
212       One or more variable assignments can start a simple command or  can  be
213       arguments  to  the  typeset, enum, export, or readonly special built-in
214       commands as well as to other declaration  commands  created  as  types.
215       The syntax for an assignment is of the form:
216
217       varname=word
218       varname[word]=word
219              No space is permitted between varname and the = or between = and
220              word.
221
222       varname=(assign_list)
223              No space is permitted between varname and the =.   The  variable
224              varname  is  unset before the assignment.  An assign_list can be
225              one of the following:
226                      word ...
227                             Indexed array assignment.
228                      [word]=word ...
229                             Associative array  assignment.   If  preceded  by
230                             typeset  -a  this  will  create  an indexed array
231                             instead.
232                      assignment ...
233                             Compound variable  assignment.   This  creates  a
234                             compound  variable  varname with sub-variables of
235                             the form varname.name, where  name  is  the  name
236                             portion of assignment.  The value of varname will
237                             contain all the assignment elements.   Additional
238                             assignments made to sub-variables of varname will
239                             also be displayed as part of the  value  of  var‐
240                             name.   If  no assignments are specified, varname
241                             will be a compound variable allowing  subsequence
242                             child elements to be defined.
243                      typeset [options] assignment ...
244                             Nested variable assignment.  Multiple assignments
245                             can be specified by separating each of them  with
246                             a  ;.   The  previous  value  is unset before the
247                             assignment.  Other declaration commands  such  as
248                             readonly,  enum,  and  other declaration commands
249                             can be used in place of typeset.
250                      . filename
251                             Include  the  assignment  commands  contained  in
252                             filename.
253
254       In addition, a += can be used in place of the = to signify adding to or
255       appending to the previous value.  When += is applied to  an  arithmetic
256       type,  word  is  evaluated as an arithmetic expression and added to the
257       current value.  When applied to a string variable, the value defined by
258       word  is appended to the value.  For compound assignments, the previous
259       value is not unset and the new values are appended to the current  ones
260       provided that the types are compatible.
261
262       The  right  hand side of a variable assignment undergoes all the expan‐
263       sion listed below except word splitting, brace expansion, and file name
264       generation.   When  the  left  hand side is an assignment is a compound
265       variable and the right hand is the name of  a  compound  variable,  the
266       compound  variable  on the right will be copied or appended to the com‐
267       pound variable on the left.
268
269   Comments.
270       A word beginning with # causes that word and all the following  charac‐
271       ters up to a new-line to be ignored.
272   Aliasing.
273       The  first  word of each command is replaced by the text of an alias if
274       an alias for this word has been defined.  An alias name consists of any
275       number of characters excluding metacharacters, quoting characters, file
276       expansion characters,  parameter  expansion  and  command  substitution
277       characters, the characters / and =.  The replacement string can contain
278       any valid shell script including the metacharacters listed above.   The
279       first  word  of  each command in the replaced text, other than any that
280       are in the process of being replaced, will be tested for  aliases.   If
281       the  last character of the alias value is a blank then the word follow‐
282       ing the alias will also be checked for alias substitution.  Aliases can
283       be  used  to  redefine built-in commands but cannot be used to redefine
284       the reserved words listed above.  Aliases can  be  created  and  listed
285       with the alias command and can be removed with the unalias command.
286       Aliasing  is  performed  when scripts are read, not while they are exe‐
287       cuted.  Therefore, for an alias to take effect,  the  alias  definition
288       command  has  to  be  executed  before the command which references the
289       alias is read.
290       The following aliases are compiled into the shell but can be  unset  or
291       redefined:
292                           autoload=′typeset -fu′
293                           command=′command  ′
294                           compound=′typeset -C′
295                           fc=hist
296                           float=′typeset -lE′
297                           functions=′typeset -f′
298                           hash=′alias -t --′
299                           history=′hist -l′
300                           integer=′typeset -li′
301                           nameref=′typeset -n′
302                           nohup=′nohup  ′
303                           r=′hist -s′
304                           redirect=′command exec′
305                           source=′command .′
306                           stop=′kill -s STOP′
307                           suspend=′kill -s STOP $$′
308                           times=′{ { time;} 2>&1;}′
309                           type=′whence -v′
310
311   Tilde Substitution.
312       After  alias  substitution is performed, each word is checked to see if
313       it begins with an unquoted .  For tilde substitution, word also refers
314       to  the  word  portion  of parameter expansion (see Parameter Expansion
315       below).  If it does, then the word up to a / is checked to  see  if  it
316       matches  a user name in the password database (See getpwname(3).)  If a
317       match is found, the and the matched login name are  replaced  by  the
318       login  directory of the matched user.  If no match is found, the origi‐
319       nal text is left unchanged.  A by itself, or in  front  of  a  /,  is
320       replaced  by  $HOME.  A followed by a + or - is replaced by the value
321       of $PWD and $OLDPWD respectively.
322
323       In addition, when expanding a variable assignment,  tilde  substitution
324       is attempted when the value of the assignment begins with a , and when
325       a appears after a :.  The : also terminates a login name.
326
327   Command Substitution.
328       The standard output from a command list enclosed  in  parentheses  pre‐
329       ceded  by  a dollar sign ( $(list) ), or in a brace group preceded by a
330       dollar sign ( ${ list;} ), or in a pair of grave accents  (``)  may  be
331       used  as part or all of a word; trailing new-lines are removed.  In the
332       second case, the { and } are treated as a reserved words so that { must
333       be  followed  by a blank and } must appear at the beginning of the line
334       or follow a ;.  In the third (obsolete) form, the  string  between  the
335       quotes  is  processed for special quoting characters before the command
336       is executed (see Quoting below).  The command substitution $(cat  file)
337       can  be  replaced  by  the equivalent but faster $(<file).  The command
338       substitution $(n<#) will expand to the current  byte  offset  for  file
339       descriptor n.  Except for the second form, the command list is run in a
340       subshell so that no side effects are possible.  For  the  second  form,
341       the final } will be recognized as a reserved word after any token.
342
343   Arithmetic Substitution.
344       An  arithmetic  expression enclosed in double parentheses preceded by a
345       dollar sign ( $(()) ) is  replaced  by  the  value  of  the  arithmetic
346       expression within the double parentheses.
347
348   Process Substitution.
349       Each  command  argument of the form <(list) or >(list) will run process
350       list asynchronously connected to some file in /dev/fd if this directory
351       exists,  or  else  a fifo a temporary directory.  The name of this file
352       will become the argument to  the  command.   If  the  form  with  >  is
353       selected  then  writing on this file will provide input for list.  If <
354       is used, then the file passed as an argument will contain the output of
355       the list process.  For example,
356
357              paste  <(cut  -f1  file1)  <(cut  -f3  file2)  | tee >(process1)
358              >(process2)
359
360       cuts fields 1 and 3 from the files file1 and file2 respectively, pastes
361       the  results  together,  and  sends  it  to  the processes process1 and
362       process2, as well as putting it onto the standard  output.   Note  that
363       the  file,  which  is  passed  as an argument to the command, is a UNIX
364       pipe(2) so programs that expect to lseek(2) on the file will not work.
365
366       Process substitution of the form <(list) can also be used  with  the  <
367       redirection  operator  which  causes  the output of list to be standard
368       input or the input for whatever file descriptor is specified.
369
370   Parameter Expansion.
371       A parameter is a variable, one or more digits, or any of the characters
372       ,  @, #, ?, -, $, and !.  A variable is denoted by a vname.  To create
373       a variable whose vname contains a ., a variable whose vname consists of
374       everything  before  the  last  .  must already exist.  A variable has a
375       value and zero or more attributes.  Variables can  be  assigned  values
376       and  attributes  by  using  the  typeset special built-in command.  The
377       attributes supported by the shell are described later with the  typeset
378       special   built-in   command.    Exported  variables  pass  values  and
379       attributes to the environment.
380
381       The shell supports both indexed and associative arrays.  An element  of
382       an  array  variable  is  referenced by a subscript.  A subscript for an
383       indexed array is denoted by an arithmetic  expression  (see  Arithmetic
384       evaluation  below) between a [ and a ].  To assign values to an indexed
385       array, use vname=(value ...) or set -A vname  value ... .  The value of
386       all  non-negative  subscripts  must  be  in  the  range  of  0  through
387       4,194,303.  A negative subscript is treated as an offset from the maxi‐
388       mum  current  index  +1 so that -1 refers to the last element.  Indexed
389       arrays can be declared with the -a option to typeset.   Indexed  arrays
390       need  not  be  declared.  Any reference to a variable with a valid sub‐
391       script is legal and an array will be created if necessary.
392
393       An associative array is created with the -A option to typeset.  A  sub‐
394       script for an associative array is denoted by a string enclosed between
395       [ and ].
396
397       Referencing any array without a subscript is equivalent to  referencing
398       the array with subscript 0.
399
400       The value of a variable may be assigned by writing:
401
402              vname=value [ vname=value ] ...
403
404       or
405              vname[subscript]=value [ vname[subscript]=value ] ...
406       Note that no space is allowed before or after the =.
407       Attributes  assigned  by  the typeset special built-in command apply to
408       all elements of the array.  An array element can be a simple  variable,
409       a  compound  variable  or  an array variable.  An element of an indexed
410       array can be either an indexed array or an associative array.  An  ele‐
411       ment  of an associative array can also be either.  To refer to an array
412       element that is part of an array element, concatenate the subscript  in
413       brackets.   For  example, to refer to the foobar element of an associa‐
414       tive array that is defined as the third element of the  indexed  array,
415       use ${vname[3][foobar]}
416       A  nameref  is  a  variable that is a reference to another variable.  A
417       nameref is created with the -n attribute of typeset.  The value of  the
418       variable  at  the time of the typeset command becomes the variable that
419       will be referenced whenever the nameref variable is used.  The name  of
420       a  nameref  cannot  contain a ..  When a variable or function name con‐
421       tains a ., and the portion of the name up to the first  .  matches  the
422       name  of  a  nameref, the variable referred to is obtained by replacing
423       the nameref portion with the name of the  variable  referenced  by  the
424       nameref.   If a nameref is used as the index of a for loop, a name ref‐
425       erence is established for each item in the list.  A nameref provides  a
426       convenient way to refer to the variable inside a function whose name is
427       passed as an argument to a function.  For example, if  the  name  of  a
428       variable is passed as the first argument to a function, the command
429              typeset -n var=$1
430       inside the function causes references and assignments to var to be ref‐
431       erences and assignments to the variable whose name has been  passed  to
432       the function.
433       If  any of the floating point attributes, -E, -F, or -X, or the integer
434       attribute, -i, is set for vname, then the value is  subject  to  arith‐
435       metic evaluation as described below.
436       Positional  parameters, parameters denoted by a number, may be assigned
437       values with the set special built-in command.  Parameter $0 is set from
438       argument zero when the shell is invoked.
439       The character $ is used to introduce substitutable parameters.
440       ${parameter}
441              The  shell reads all the characters from ${ to the matching } as
442              part of the same word even if it contains braces or  metacharac‐
443              ters.   The value, if any, of the parameter is substituted.  The
444              braces are required when parameter  is  followed  by  a  letter,
445              digit,  or  underscore  that is not to be interpreted as part of
446              its name, when the variable name contains a ..  The  braces  are
447              also  required  when a variable is subscripted unless it is part
448              of an Arithmetic Expression or  a  Conditional  Expression.   If
449              parameter  is one or more digits then it is a positional parame‐
450              ter.  A positional parameter of more  than  one  digit  must  be
451              enclosed  in braces.  If parameter is or @, then all the posi‐
452              tional parameters, starting with $1, are substituted  (separated
453              by  a  field  separator character).  If an array vname with last
454              subscript ∗ @, or for index arrays of the form  sub1  ..   sub2.
455              is  used,  then  the value for each of the elements between sub1
456              and sub2 inclusive (or all elements for and @) is substituted,
457              separated by the first character of the value of IFS.
458       ${#parameter}
459              If  parameter  is or @, the number of positional parameters is
460              substituted.  Otherwise, the length of the value of the  parame‐
461              ter is substituted.
462       ${#vname[*]}
463       ${#vname[@]}
464              The number of elements in the array vname is substituted.
465
466       ${@vname}
467              Expands  to  the  type  name  (See  Type  Variables    below) or
468              attributes of the variable referred to by vname.
469       ${!vname}
470              Expands to the name of the variable referred to by vname.   This
471              will be vname except when vname is a name reference.
472       ${!vname[subscript]}
473              Expands  to  name of the subscript unless subscript is *, @.  or
474              of the form sub1 ..  sub2.  When subscript is  *,  the  list  of
475              array subscripts for vname is generated.  For a variable that is
476              not an array, the value is 0 if the variable is set.   Otherwise
477              it  is  null.   When  subscript is @, same as above, except that
478              when used in double quotes, each array subscript yields a  sepa‐
479              rate  argument.   When subscript is of the form sub1 ..  sub2 it
480              expands to the list of subscripts between sub1 and  sub2  inclu‐
481              sive using the same quoting rules as @.
482       ${!prefix*}
483              Expands  to  the  names  of the variables whose names begin with
484              prefix.
485       ${parameter:-word}
486              If parameter is set and is non-null then substitute  its  value;
487              otherwise substitute word.
488       ${parameter:=word}
489              If  parameter  is  not  set  or is null then set it to word; the
490              value of the parameter is then substituted.  Positional  parame‐
491              ters may not be assigned to in this way.
492       ${parameter:?word}
493              If  parameter  is set and is non-null then substitute its value;
494              otherwise, print word and exit from the shell (if  not  interac‐
495              tive).  If word is omitted then a standard message is printed.
496       ${parameter:+word}
497              If parameter is set and is non-null then substitute word; other‐
498              wise substitute nothing.
499       In the above, word is not evaluated unless it is to be used as the sub‐
500       stituted  string,  so  that,  in the following example, pwd is executed
501       only if d is not set or is null:
502              print ${d:-$(pwd)}
503       If the colon ( : ) is omitted from  the  above  expressions,  then  the
504       shell only checks whether parameter is set or not.
505       ${parameter:offset:length}
506       ${parameter:offset}
507              Expands to the portion of the value of parameter starting at the
508              character (counting from 0) determined by expanding offset as an
509              arithmetic expression and consisting of the number of characters
510              determined by the arithmetic expression defined by  length.   In
511              the second form, the remainder of the value is used.  If A nega‐
512              tive offset counts backwards from the end  of  parameter.   Note
513              that  one or more blanks is required in front of a minus sign to
514              prevent the shell from interpreting  the  operator  as  :-.   If
515              parameter is or @, or is an array name indexed by or @, then
516              offset and length refer to the array index and  number  of  ele‐
517              ments  respectively.  A negative offset is taken relative to one
518              greater than the highest  subscript  for  indexed  arrays.   The
519              order for associate arrays is unspecified.
520       ${parameter#pattern}
521       ${parameter##pattern}
522              If  the  shell  pattern  matches  the  beginning of the value of
523              parameter, then the value of this expansion is the value of  the
524              parameter  with the matched portion deleted; otherwise the value
525              of this parameter is substituted.  In the first form the  small‐
526              est  matching  pattern  is  deleted  and  in the second form the
527              largest matching pattern is deleted.  When parameter is @, *, or
528              an array variable with subscript @ or *, the substring operation
529              is applied to each element in turn.
530
531       ${parameter%pattern}
532       ${parameter%%pattern}
533              If the shell pattern matches the end of the value of  parameter,
534              then  the  value of this expansion is the value of the parameter
535              with the matched part deleted; otherwise substitute the value of
536              parameter.   In  the first form the smallest matching pattern is
537              deleted and in the second form the largest matching  pattern  is
538              deleted.  When parameter is @, *, or an array variable with sub‐
539              script @ or *, the substring operation is applied to  each  ele‐
540              ment in turn.
541
542       ${parameter/pattern/string}
543       ${parameter//pattern/string}
544       ${parameter/#pattern/string}
545       ${parameter/%pattern/string}
546              Expands parameter and replaces the longest match of pattern with
547              the given string.  Each occurrence of \n in string  is  replaced
548              by  the  portion of parameter that matches the n-th sub-pattern.
549              In the first form, only  the  first  occurrence  of  pattern  is
550              replaced.   In  the  second  form,  each  match  for  pattern is
551              replaced by the given string.  The third form restricts the pat‐
552              tern  match to the beginning of the string while the fourth form
553              restricts the pattern match to the  end  of  the  string.   When
554              string  is  null, the pattern will be deleted and the / in front
555              of string may be omitted.  When parameter is @, *, or  an  array
556              variable  with  subscript  @ or *, the substitution operation is
557              applied to each element in turn.  In this case, the string  por‐
558              tion of word will be re-evaluated for each element.
559
560       The following parameters are automatically set by the shell:
561              #      The number of positional parameters in decimal.
562              -      Options supplied to the shell on invocation or by the set
563                     command.
564              ?      The decimal value returned by the last executed command.
565              $      The process number of this shell.
566              _      Initially, the value of _ is an absolute pathname of  the
567                     shell  or script being executed as passed in the environ‐
568                     ment.  Subsequently it is assigned the last  argument  of
569                     the previous command.  This parameter is not set for com‐
570                     mands which are asynchronous.   This  parameter  is  also
571                     used  to  hold  the  name  of the matching MAIL file when
572                     checking for mail.  While defining a compound variable or
573                     a  type,  _ is initialized as a reference to the compound
574                     variable or type.  When a discipline function is invoked,
575                     _  is  initialized as a reference to the variable associ‐
576                     ated with the call to this function.  Finally when  _  is
577                     used  as the name of the first variable of a type defini‐
578                     tion, the new type is derived from the type of the  first
579                     variable (See Type Variables  below.).
580              !      The  process  id  or  the pool name and job number of the
581                     last background command invoked or the  most  recent  job
582                     put  in  the  background  with  the  bg built-in command.
583                     Background jobs started in a named pool will  be  in  the
584                     form  pool.number  where pool is the pool name and number
585                     is the job number within that pool.
586              .sh.command
587                     When processing a DEBUG trap, this variable contains  the
588                     current command line that is about to run.
589              .sh.edchar
590                     This  variable contains the value of the keyboard charac‐
591                     ter (or sequence of characters if the first character  is
592                     an  ESC, ascii 033) that has been entered when processing
593                     a KEYBD trap (see Key Bindings below).  If the  value  is
594                     changed  as  part  of the trap action, then the new value
595                     replaces the key (or key sequence) that caused the trap.
596              .sh.edcol
597                     The character position of the cursor at the time  of  the
598                     most recent KEYBD trap.
599              .sh.edmode
600                     The  value  is  set  to  ESC when processing a KEYBD trap
601                     while in vi insert mode.  (See Vi Editing Mode    below.)
602                     Otherwise,  .sh.edmode  is  null  when processing a KEYBD
603                     trap.
604              .sh.edtext
605                     The characters in the input buffer at  the  time  of  the
606                     most  recent KEYBD trap.  The value is null when not pro‐
607                     cessing a KEYBD trap.
608              .sh.file
609                     The pathname of the file than contains the  current  com‐
610                     mand.
611              .sh.fun
612                     The name of the current function that is being executed.
613              .sh.level
614                     Set  to  the current function depth.  This can be changed
615                     inside a DEBUG trap and will set the context to the spec‐
616                     ified level.
617              .sh.lineno
618                     Set during a DEBUG trap to the line number for the caller
619                     of each function.
620              .sh.match
621                     An indexed array which stores the most recent  match  and
622                     sub-pattern  matches  after  conditional  pattern matches
623                     that match and after variables expansions using the oper‐
624                     ators  #,  %, or /.  The 0-th element stores the complete
625                     match and the i-th.  element stores  the  i-th  submatch.
626                     The  .sh.match  variable  becomes unset when the variable
627                     that has expanded is assigned a new value.
628              .sh.math
629                     Used for defining arithmetic  functions  (see  Arithmetic
630                     evaluation  below).   and stores the list of user defined
631                     arithmetic functions.
632              .sh.name
633                     Set to the name of the variable at the time that a disci‐
634                     pline function is invoked.
635              .sh.subscript
636                     Set  to  the  name  subscript of the variable at the time
637                     that a discipline function is invoked.
638              .sh.subshell
639                     The current depth for subshells and command substitution.
640              .sh.value
641                     Set to the value of the variable at the time that the set
642                     or  append  discipline  function is invoked.  When a user
643                     defined arithmetic function  is  invoked,  the  value  of
644                     .sh.value  is  saved  and .sh.value is set to long double
645                     precision floating point.  .sh.value is restored when the
646                     function returns.
647              .sh.version
648                     Set to a value that identifies the version of this shell.
649              KSH_VERSION
650                     A name reference to .sh.version.
651              LINENO The  current  line  number  within the script or function
652                     being executed.
653              OLDPWD The previous working directory set by the cd command.
654              OPTARG The value of the last option argument  processed  by  the
655                     getopts built-in command.
656              OPTIND The  index  of  the last option argument processed by the
657                     getopts built-in command.
658              PPID   The process number of the parent of the shell.
659              PWD    The present working directory set by the cd command.
660              RANDOM Each time this variable is referenced, a random  integer,
661                     uniformly  distributed between 0 and 32767, is generated.
662                     The sequence of random  numbers  can  be  initialized  by
663                     assigning a numeric value to RANDOM.
664              REPLY  This  variable  is set by the select statement and by the
665                     read built-in command when no arguments are supplied.
666              SECONDS
667                     Each time this variable is referenced, the number of sec‐
668                     onds  since  shell invocation is returned.  If this vari‐
669                     able is assigned a value, then the  value  returned  upon
670                     reference  will  be  the value that was assigned plus the
671                     number of seconds since the assignment.
672              SHLVL  An integer variable the  is  incremented  each  time  the
673                     shell is invoked and is exported.  If SHLVL is not in the
674                     environment when the shell is invoked, it is set to 1.
675
676       The following variables are used by the shell:
677              CDPATH The search path for the cd command.
678              COLUMNS
679                     If this variable is set, the value is used to define  the
680                     width of the edit window for the shell edit modes and for
681                     printing select lists.
682              EDITOR If the VISUAL variable is not  set,  the  value  of  this
683                     variable  will  be  checked for the patterns as described
684                     with VISUAL below and the  corresponding  editing  option
685                     (see Special Command set below) will be turned on.
686              ENV    If  this  variable is set, then parameter expansion, com‐
687                     mand substitution, and arithmetic substitution  are  per‐
688                     formed  on  the  value  to  generate  the pathname of the
689                     script that will be executed when the  shell  is  invoked
690                     interactively (see Invocation below).  This file is typi‐
691                     cally used  for  alias  and  function  definitions.   The
692                     default value is $HOME/.kshrc.  On systems that support a
693                     system wide  /etc/ksh.kshrc initialization file,  if  the
694                     filename  generated  by  the expansion of ENV begins with
695                     /./ or ././ the system wide initialization file will  not
696                     be executed.
697              FCEDIT Obsolete  name  for  the default editor name for the hist
698                     command.  FCEDIT is not used when HISTEDIT is set.
699              FIGNORE
700                     A pattern that defines the set of filenames that will  be
701                     ignored when performing filename matching.
702              FPATH  The  search  path for function definitions.  The directo‐
703                     ries in this path are searched for a file with  the  same
704                     name  as the function or command when a function with the
705                     -u attribute is referenced and  when  a  command  is  not
706                     found.   If an executable file with the name of that com‐
707                     mand is found, then it is read and executed in  the  cur‐
708                     rent  environment.   Unlike  PATH,  the current directory
709                     must be represented explicitly by .  rather than by adja‐
710                     cent : characters or a beginning or ending :.
711              HISTCMD
712                     Number of the current command in the history file.
713              HISTEDIT
714                     Name for the default editor name for the hist command.
715              HISTFILE
716                     If  this  variable is set when the shell is invoked, then
717                     the value is the pathname of the file that will  be  used
718                     to  store  the  command  history  (see  Command  Re-entry
719                     below).
720              HISTSIZE
721                     If this variable is set when the shell is  invoked,  then
722                     the number of previously entered commands that are acces‐
723                     sible by this shell will be greater than or equal to this
724                     number.  The default is 512.
725              HOME   The default argument (home directory) for the cd command.
726              IFS    Internal  field separators, normally space, tab, and new-
727                     line that are used to separate  the  results  of  command
728                     substitution  or  parameter  expansion  and  to  separate
729                     fields with the built-in command read.  The first charac‐
730                     ter of the IFS variable is used to separate arguments for
731                     the "$∗" substitution (see Quoting below).   Each  single
732                     occurrence of an IFS character in the string to be split,
733                     that is not in the isspace character class, and any adja‐
734                     cent  characters in IFS that are in the isspace character
735                     class, delimit a field.  One or more  characters  in  IFS
736                     that  belong  to  the  isspace character class, delimit a
737                     field.   In  addition,  if  the  same  isspace  character
738                     appears  consecutively  inside  IFS,  this  character  is
739                     treated as if it were not in the isspace class,  so  that
740                     if  IFS consists of two tab characters, then two adjacent
741                     tab characters delimit a null field.
742              JOBMAX This variable defines the maximum  number  running  back‐
743                     ground  jobs  that can run at a time.  When this limit is
744                     reached, the shell will wait for a job to complete before
745                     staring a new job.
746              LANG   This variable determines the locale category for any cat‐
747                     egory not specifically selected with a variable  starting
748                     with LC_ or LANG.
749              LC_ALL This  variable  overrides  the value of the LANG variable
750                     and any other LC_ variable.
751              LC_COLLATE
752                     This variable determines the locale category for  charac‐
753                     ter collation information.
754              LC_CTYPE
755                     This  variable determines the locale category for charac‐
756                     ter handling  functions.   It  determines  the  character
757                     classes  for  pattern  matching (see File Name Generation
758                     below).
759              LC_NUMERIC
760                     This variable determines the locale category for the dec‐
761                     imal point character.
762              LINES  If  this  variable is set, the value is used to determine
763                     the column length  for  printing  select  lists.   Select
764                     lists  will  print  vertically  until about two-thirds of
765                     LINES lines are filled.
766              MAIL   If this variable is set to the name of a  mail  file  and
767                     the  MAILPATH variable is not set, then the shell informs
768                     the user of arrival of mail in the specified file.
769              MAILCHECK
770                     This variable specifies how often (in seconds) the  shell
771                     will check for changes in the modification time of any of
772                     the files specified by the MAILPATH  or  MAIL  variables.
773                     The  default  value  is  600  seconds.  When the time has
774                     elapsed the shell will  check  before  issuing  the  next
775                     prompt.
776              MAILPATH
777                     A  colon  (  :  )  separated list of file names.  If this
778                     variable is set, then the shell informs the user  of  any
779                     modifications  to  the specified files that have occurred
780                     within the last MAILCHECK seconds.  Each file name can be
781                     followed by a ?  and a message that will be printed.  The
782                     message will undergo parameter expansion, command substi‐
783                     tution,  and arithmetic substitution with the variable $_
784                     defined as the name of the file that  has  changed.   The
785                     default message is you have mail in $_.
786              PATH   The  search path for commands (see Execution below).  The
787                     user may not change PATH if executing under rksh  (except
788                     in .profile).
789              PS1    The  value  of  this  variable  is expanded for parameter
790                     expansion, command substitution, and arithmetic substitu‐
791                     tion to define the primary prompt string which by default
792                     is ``$''.  The character !  in the primary prompt  string
793                     is  replaced  by the command number (see Command Re-entry
794                     below).  Two successive occurrences of !  will produce  a
795                     single !  when the prompt string is printed.
796              PS2    Secondary prompt string, by default ``> ''.
797              PS3    Selection  prompt  string  used  within a select loop, by
798                     default ``#? ''.
799              PS4    The value of this  variable  is  expanded  for  parameter
800                     evaluation,  command substitution, and arithmetic substi‐
801                     tution and precedes each line of an execution trace.   By
802                     default,  PS4  is ``+ ''.  In addition when PS4 is unset,
803                     the execution trace prompt is also ``+ ''.
804              SHELL  The pathname of the shell is kept in the environment.  At
805                     invocation,  if  the  basename  of  this variable is rsh,
806                     rksh, or krsh, then the shell becomes restricted.  If  it
807                     is  pfsh or pfksh, then the shell becomes a profile shell
808                     (see pfexec(1)).
809              TIMEFORMAT
810                     The value of this parameter is used as  a  format  string
811                     specifying  how the timing information for pipelines pre‐
812                     fixed with the time reserved word  should  be  displayed.
813                     The  %  character  introduces  a  format sequence that is
814                     expanded to a time value or other information.  The  for‐
815                     mat sequences and their meanings are as follows.
816                     %%        A literal %.
817                     %[p][l]R  The elapsed time in seconds.
818                     %[p][l]U  The number of CPU seconds spent in user mode.
819                     %[p][l]S  The number of CPU seconds spent in system mode.
820                     %P        The CPU percentage, computed as (U + S) / R.
821
822                     The brackets denote optional portions.  The optional p is
823                     a digit specifying the precision,  the  number  of  frac‐
824                     tional digits after a decimal point.  A value of 0 causes
825                     no decimal point or fraction to be output.  At most three
826                     places  after  the decimal point can be displayed; values
827                     of p greater than 3 are treated as 3.  If p is not speci‐
828                     fied, the value 3 is used.
829
830                     The optional l specifies a longer format, including hours
831                     if greater than zero, minutes, and seconds  of  the  form
832                     HHhMMmSS.FFs.   The  value of p determines whether or not
833                     the fraction is included.
834
835                     All other characters are  output  without  change  and  a
836                     trailing  newline is added.  If unset, the default value,
837                     $'\nreal\t%2lR\nuser\t%2lU\nsys%2lS', is  used.   If  the
838                     value is null, no timing information is displayed.
839
840              TMOUT  If  set  to  a value greater than zero, TMOUT will be the
841                     default timeout value for the read built-in command.  The
842                     select  compound  command  terminates after TMOUT seconds
843                     when input is from a terminal.  Otherwise, the shell will
844                     terminate  if a line is not entered within the prescribed
845                     number of seconds while reading from a  terminal.   (Note
846                     that  the  shell can be compiled with a maximum bound for
847                     this value which cannot be exceeded.)
848
849              VISUAL If  the  value  of  this  variable  matches  the  pattern
850                     *[Vv][Ii]*,  then  the vi option (see Special Command set
851                     below) is turned on.  If the value  matches  the  pattern
852                     *gmacs*  ,  the  gmacs option is turned on.  If the value
853                     matches the pattern *macs*, then the emacs option will be
854                     turned  on.   The  value of VISUAL overrides the value of
855                     EDITOR.
856
857       The shell gives default values to PATH, PS1, PS2, PS3, PS4,  MAILCHECK,
858       FCEDIT,  TMOUT and IFS, while HOME, SHELL, ENV, and MAIL are not set at
859       all by the shell (although HOME is set by login(1)).  On  some  systems
860       MAIL and SHELL are also set by login(1).
861
862   Field Splitting.
863       After parameter expansion and command substitution, the results of sub‐
864       stitutions are scanned for the field separator characters (those  found
865       in IFS) and split into distinct fields where such characters are found.
866       Explicit null fields ("" or ′′) are  retained.   Implicit  null  fields
867       (those resulting from parameters that have no values or command substi‐
868       tutions with no output) are removed.
869
870       If the braceexpand (-B) option is set then each of the fields resulting
871       from  IFS  are  checked to see if they contain one or more of the brace
872       patterns {*,*}, {l1..l2} , {n1..n2} , {n1..n2% fmt} , {n1..n2  ..n3}  ,
873       or {n1..n2 ..n3%fmt} , where * represents any character, l1,l2 are let‐
874       ters and n1,n2,n3 are signed numbers and fmt is a format  specified  as
875       used  by  printf.   In  each case, fields are created by prepending the
876       characters before the { and appending the characters  after  the  }  to
877       each  of  the  strings generated by the characters between the { and }.
878       The resulting fields are checked to see if they  have  any  brace  pat‐
879       terns.
880
881       In  the first form, a field is created for each string between { and ,,
882       between , and ,, and between , and }.  The string represented by *  can
883       contain  embedded  matching { and } without quoting.  Otherwise, each {
884       and } with * must be quoted.
885
886       In the seconds form, l1 and l2 must both be either upper case  or  both
887       be lower case characters in the C locale.  In this case a field is cre‐
888       ated for each character from l1 thru l2.
889
890       In the remaining forms, a field is created for each number starting  at
891       n1 and continuing until it reaches n2 incrementing n1 by n3.  The cases
892       where n3 is not specified behave as if n3 where 1 if n1<=n2 and -1 oth‐
893       erwise.   If forms which specify %fmt any format flags, widths and pre‐
894       cisions can be specified and fmt can  end  in  any  of  the  specifiers
895       cdiouxX.   For  example,  {a,z}{1..5..3%02d}{b..c}x  expands  to  the 8
896       fields, a01bx, a01cx, a04bx, a04cx, z01bx, z01cx, z04bx and z4cx.
897
898   File Name Generation.
899       Following splitting, each field is scanned for the characters , ?,  (,
900       and  [  unless  the -f option has been set.  If one of these characters
901       appears, then the word is regarded as a pattern.  Each file name compo‐
902       nent  that  contains  any  pattern character is replaced with a lexico‐
903       graphically sorted set of names that  matches  the  pattern  from  that
904       directory.   If  no  file  name is found that matches the pattern, then
905       that component of the filename is left unchanged unless the pattern  is
906       prefixed  with ∼(N) in which case it is removed as described below.  If
907       FIGNORE is set, then each file name component that matches the  pattern
908       defined by the value of FIGNORE is ignored when generating the matching
909       filenames.  The names .  and ..  are also ignored.  If FIGNORE  is  not
910       set,  the character .  at the start of each file name component will be
911       ignored unless the first character of the pattern corresponding to this
912       component  is  the  character  .  itself.  Note, that for other uses of
913       pattern matching the / and .  are not treated specially.
914
915              Matches any string, including the null string.  When used
916                     for filename expansion, if the globstar option is on, two
917                     adjacent 's by itself will match all files and  zero  or
918                     more  directories and subdirectories.  If followed by a /
919                     then only directories and subdirectories will match.
920              ?      Matches any single character.
921              [...]  Matches any one of the enclosed characters.   A  pair  of
922                     characters separated by - matches any character lexically
923                     between the pair, inclusive.  If the first character fol‐
924                     lowing  the opening [ is a !  or ^ then any character not
925                     enclosed is matched.  A - can be included in the  charac‐
926                     ter set by putting it as the first or last character.
927                     Within  [  and ], character classes can be specified with
928                     the syntax [:class:] where class is one of the  following
929                     classes  defined  in the ANSI-C standard: (Note that word
930                     is equivalent to alnum plus the character _.)
931                     alnum alpha blank cntrl digit  graph  lower  print  punct
932                     space upper word xdigit
933                     Within  [  and  ],  an equivalence class can be specified
934                     with the syntax [=c=] which matches all  characters  with
935                     the same primary collation weight (as defined by the cur‐
936                     rent locale) as the character c.  Within [ and ],  [.sym‐
937                     bol.]  matches the collating symbol symbol.
938       A  pattern-list  is  a list of one or more patterns separated from each
939       other with a & or .  A & signifies that all patterns must  be  matched
940       whereas  requires  that only one pattern be matched.  Composite pat‐
941       terns can be formed with one or more of the following sub-patterns:
942              ?(pattern-list)
943                     Optionally matches any one of the given patterns.
944              *(pattern-list)
945                     Matches zero or more occurrences of the given patterns.
946              +(pattern-list)
947                     Matches one or more occurrences of the given patterns.
948              {n}(pattern-list)
949                     Matches n occurrences of the given patterns.
950              {m,n}(pattern-list)
951                     Matches from m to n occurrences of  the  given  patterns.
952                     If  m  is  omitted,  0  will be used.  If n is omitted at
953                     least m occurrences will be matched.
954              @(pattern-list)
955                     Matches exactly one of the given patterns.
956              !(pattern-list)
957                     Matches anything except one of the given patterns.
958       By default, each pattern, or sub-pattern will match the longest  string
959       possible consistent with generating the longest overall match.  If more
960       than one match is possible, the one starting closest to  the  beginning
961       of the string will be chosen.   However, for each of the above compound
962       patterns a - can be inserted in front of the ( to  cause  the  shortest
963       match to the specified pattern-list to be used.
964
965       When  pattern-list is contained within parentheses, the backslash char‐
966       acter \ is treated specially even when inside a character class.    All
967       ANSI-C character escapes are recognized and match the specified charac‐
968       ter.  In addition the following escape sequences are recognized:
969              \d     Matches any character in the digit class.
970              \D     Matches any character not in the digit class.
971              \s     Matches any character in the space class.
972              \S     Matches any character not in the space class.
973              \w     Matches any character in the word class.
974              \W     Matches any character not in the word class.
975
976       A pattern of the form %(pattern-pair(s)) is a sub-pattern that  can  be
977       used to match nested character expressions.  Each pattern-pair is a two
978       character sequence which cannot contain & or .  The first pattern-pair
979       specifies  the starting and ending characters for the match.  Each sub‐
980       sequent pattern-pair represents the beginning and ending characters  of
981       a  nested  group  that  will be skipped over when counting starting and
982       ending character matches.  The behavior is unspecified when  the  first
983       character of a pattern-pair is alpha-numeric except for the following:
984              D      Causes  the  ending character to terminate the search for
985                     this pattern without finding a match.
986              E      Causes the ending  character  to  be  interpreted  as  an
987                     escape character.
988              L      Causes  the ending character to be interpreted as a quote
989                     character causing all characters to be ignored when look‐
990                     ing for a match.
991              Q      Causes  the ending character to be interpreted as a quote
992                     character causing all characters other  than  any  escape
993                     character to be ignored when looking for a match.
994       Thus,  %({}Q"E\), matches characters starting at { until the matching }
995       is found not counting any { or } that is inside a double quoted  string
996       or  preceded  by  the  escape character \.  Without the {} this pattern
997       matches any C language string.
998
999       Each sub-pattern in a composite pattern is numbered, starting at 1,  by
1000       the  location of the ( within the pattern.  The sequence \n, where n is
1001       a single digit and \n comes after the n-th.  sub-pattern,  matches  the
1002       same string as the sub-pattern itself.
1003
1004       Finally  a  pattern can contain sub-patterns of the form ∼(options:pat‐
1005       tern-list), where either  options  or  :pattern-list  can  be  omitted.
1006       Unlike  the other compound patterns, these sub-patterns are not counted
1007       in the  numbered  sub-patterns.   :pattern-list  must  be  omitted  for
1008       options  F,  G, N , and V below.  If options is present, it can consist
1009       of one or more of the following:
1010              +      Enable the following options.  This is the default.
1011              -      Disable the following options.
1012              E      The  remainder  of  the  pattern  uses  extended  regular
1013                     expression syntax like the egrep(1) command.
1014              F      The  remainder  of  the  pattern uses fgrep(1) expression
1015                     syntax.
1016              G      The remainder of the pattern uses basic  regular  expres‐
1017                     sion syntax like the grep(1) command.
1018              K      The  remainder  of the pattern uses shell pattern syntax.
1019                     This is the default.
1020              N      This is ignored.  However, when it is  the  first  letter
1021                     and  is  used  with  file name generation, and no matches
1022                     occur, the file pattern expands to the empty string.
1023              X      The remainder  of  the  pattern  uses  augmented  regular
1024                     expression syntax like the xgrep(1) command.
1025              P      The remainder of the pattern uses perl(1) regular expres‐
1026                     sion syntax.  Not all perl regular expression  syntax  is
1027                     currently implemented.
1028              V      The  remainder  of  the  pattern  uses  System  V regular
1029                     expression syntax.
1030              i      Treat the match as case insensitive.
1031              g      File the longest match (greedy).  This is the default.
1032              l      Left anchor the pattern.  This is the default for K style
1033                     patterns.
1034              r      Right  anchor  the  pattern.   This  is the default for K
1035                     style patterns.
1036       If both options and :pattern-list are specified, then the options apply
1037       only to  pattern-list.  Otherwise, these options remain in effect until
1038       they are disabled by a subsequent ∼(...) or at the end of the  sub-pat‐
1039       tern containing ∼(...).
1040
1041   Quoting.
1042       Each of the metacharacters listed earlier (see Definitions above) has a
1043       special meaning to the shell and causes termination of  a  word  unless
1044       quoted.   A character may be quoted (i.e., made to stand for itself) by
1045       preceding it with a \.  The pair \new-line is removed.  All  characters
1046       enclosed between a pair of single quote marks (′′) that is not preceded
1047       by a $ are quoted.  A single quote  cannot  appear  within  the  single
1048       quotes.   A single quoted string preceded by an unquoted $ is processed
1049       as an ANSI-C string except for the following:
1050       \0     Causes the remainder of the string to be ignored.
1051       \E     Equivalent to the escape character (ascii 033),
1052       \e     Equivalent to the escape character (ascii 033),
1053       \cx    Expands to the character control-x.
1054       \C[.name.]
1055              Expands to the collating element name.
1056
1057       Inside double quote marks  (""),  parameter  and  command  substitution
1058       occur  and  \  quotes the characters \, `, ", and $.  A $ in front of a
1059       double quoted string will be ignored in the "C" or "POSIX" locale,  and
1060       may  cause the string to be replaced by a locale specific string other‐
1061       wise.  The meaning of $∗ and $@ is identical when not  quoted  or  when
1062       used  as  a variable assignment value or as a file name.  However, when
1063       used as a command argument, "$∗" is equivalent to "$1d$2d...", where  d
1064       is  the first character of the IFS variable, whereas "$@" is equivalent
1065       to "$1" "$2" ....  Inside grave quote marks (``), \ quotes the  charac‐
1066       ters \, `, and $.  If the grave quotes occur within double quotes, then
1067       \ also quotes the character ".
1068
1069       The special meaning of reserved words or  aliases  can  be  removed  by
1070       quoting  any  character of the reserved word.  The recognition of func‐
1071       tion names or built-in command names listed below cannot be altered  by
1072       quoting them.
1073
1074   Arithmetic Evaluation.
1075       The  shell  performs arithmetic evaluation for arithmetic substitution,
1076       to evaluate an arithmetic command, to evaluate an  indexed  array  sub‐
1077       script,  and  to  evaluate arguments to the built-in commands shift and
1078       let.  Evaluations are performed using double precision  floating  point
1079       arithmetic  or  long  double  precision floating point for systems that
1080       provide this data type.  Floating point  constants  follow  the  ANSI-C
1081       programming  language  floating  point conventions.  The floating point
1082       constants Nan and Inf can be use to represent "not a number" and infin‐
1083       ity respectively.  Integer constants follow the ANSI-C programming lan‐
1084       guage integer constant conventions although only single byte  character
1085       constants  are  recognized  and character casts are not recognized.  In
1086       addition constants can be of the form [base#]n where base is a  decimal
1087       number  between two and sixty-four representing the arithmetic base and
1088       n is a number in that base.  The digits above 9 are represented by  the
1089       lower case letters, the upper case letters, @, and _ respectively.  For
1090       bases less than or equal to 36, upper and lower case characters can  be
1091       used interchangeably.
1092
1093       An arithmetic expression uses the same syntax, precedence, and associa‐
1094       tivity of expression as the C language.  All the C  language  operators
1095       that  apply to floating point quantities can be used.  In addition, the
1096       operator ** can be used for exponentiation.  It has  higher  precedence
1097       than  multiplication  and  is  left associative.  In addition, when the
1098       value of an arithmetic variable or sub-expression can be represented as
1099       a  long  integer,  all  C language integer arithmetic operations can be
1100       performed.  Variables can be referenced by name  within  an  arithmetic
1101       expression  without using the parameter expansion syntax.  When a vari‐
1102       able is referenced, its value is evaluated as an arithmetic expression.
1103
1104       Any of the following math library functions that  are  in  the  C  math
1105       library can be used within an arithmetic expression:
1106
1107       abs  acos acosh asin asinh atan atan2 atanh cbrt ceil copysign cos cosh
1108       erf erfc exp exp2 expm1 fabs fpclassify fdim finite floor fma fmax fmin
1109       fmod  hypot ilogb int isfinite sinf isnan isnormal issubnormal issubor‐
1110       dered iszero j0 j1 jn lgamma log log10 log2  logb  nearbyint  nextafter
1111       nexttoward  pow  remainder  rint  round scanb signbit sin sinh sqrt tan
1112       tanh tgamma trunc y0 y1 yn In addition,  arithmetic  functions  can  be
1113       define as shell functions with a variant of the function name syntax,
1114
1115       function .sh.math.name ident ... { list ;}
1116              where  name  is the function name used in the arithmetic expres‐
1117              sion and each identifier, ident is a name reference to the  long
1118              double   precision   floating  point  argument.   The  value  of
1119              .sh.value when the function returns is the value of  this  func‐
1120              tion.   User  defined  functions  can take up to 3 arguments and
1121              override C math library functions.
1122
1123       An internal representation of a variable as a double precision floating
1124       point can be specified with the -E [n], -F [n], or -X [n] option of the
1125       typeset special built-in command.  The -E option causes  the  expansion
1126       of  the  value  to  be represented using scientific notation when it is
1127       expanded.  The optional option argument n defines the number of signif‐
1128       icant figures.  The -F option causes the expansion to be represented as
1129       a floating decimal number when it is expanded.  The -X option cause the
1130       expansion  to  be  represented using the %a format defined by ISO C-99.
1131       The optional option argument n defines the number of places  after  the
1132       decimal (or radix) point in this case.
1133
1134       An  internal integer representation of a variable can be specified with
1135       the -i [n]  option  of  the  typeset  special  built-in  command.   The
1136       optional option argument n specifies an arithmetic base to be used when
1137       expanding the variable.  If you do not specify an arithmetic base, base
1138       10 will be used.
1139
1140       Arithmetic evaluation is performed on the value of each assignment to a
1141       variable with the -E, -F, -X, or -i attribute.   Assigning  a  floating
1142       point  number  to  a variable whose type is an integer causes the frac‐
1143       tional part to be truncated.
1144
1145   Prompting.
1146       When used interactively, the shell prompts with the value of PS1  after
1147       expanding  it for parameter expansion, command substitution, and arith‐
1148       metic substitution, before reading a command.  In addition, each single
1149       !   in the prompt is replaced by the command number.  A !!  is required
1150       to place !  in the prompt.  If at any time a new-line is typed and fur‐
1151       ther  input  is needed to complete a command, then the secondary prompt
1152       (i.e., the value of PS2) is issued.
1153
1154   Conditional Expressions.
1155       A conditional expression is used with the [[ compound command  to  test
1156       attributes  of  files and to compare strings.  Field splitting and file
1157       name generation are not performed on the words between [[ and ]].  Each
1158       expression  can  be constructed from one or more of the following unary
1159       or binary expressions:
1160       string True, if string is not null.
1161       -a file
1162              Same as -e below.  This is obsolete.
1163       -b file
1164              True, if file exists and is a block special file.
1165       -c file
1166              True, if file exists and is a character special file.
1167       -d file
1168              True, if file exists and is a directory.
1169       -e file
1170              True, if file exists.
1171       -f file
1172              True, if file exists and is an ordinary file.
1173       -g file
1174              True, if file exists and it has its setgid bit set.
1175       -k file
1176              True, if file exists and it has its sticky bit set.
1177       -n string
1178              True, if length of string is non-zero.
1179       -o ?option
1180              True, if option named option is a valid option name.
1181       -o option
1182              True, if option named option is on.
1183       -p file
1184              True, if file exists and is a fifo special file or a pipe.
1185       -r file
1186              True, if file exists and is readable by current process.
1187       -s file
1188              True, if file exists and has size greater than zero.
1189       -t fildes
1190              True, if file descriptor number fildes is  open  and  associated
1191              with a terminal device.
1192       -u file
1193              True, if file exists and it has its setuid bit set.
1194       -v name
1195              True, if variable name is a valid variable name and is set.
1196       -w file
1197              True, if file exists and is writable by current process.
1198       -x file
1199              True,  if  file exists and is executable by current process.  If
1200              file exists and is a directory, then true if the current process
1201              has permission to search in the directory.
1202       -z string
1203              True, if length of string is zero.
1204       -L file
1205              True, if file exists and is a symbolic link.
1206       -h file
1207              True, if file exists and is a symbolic link.
1208       -N file
1209              True,  if  file exists and the modification time is greater than
1210              the last access time.
1211       -O file
1212              True, if file exists and is owned by the effective  user  id  of
1213              this process.
1214       -G file
1215              True,  if  file exists and its group matches the effective group
1216              id of this process.
1217       -R name
1218              True if variable name is a name reference.
1219       -S file
1220              True, if file exists and is a socket.
1221       file1 -nt file2
1222              True, if file1 exists and file2 does not, or file1 is newer than
1223              file2.
1224       file1 -ot file2
1225              True, if file2 exists and file1 does not, or file1 is older than
1226              file2.
1227       file1 -ef file2
1228              True, if file1 and file2 exist and refer to the same file.
1229       string == pattern
1230              True, if string matches pattern.  Any part  of  pattern  can  be
1231              quoted to cause it to be matched as a string.  With a successful
1232              match to a pattern, the .sh.match array  variable  will  contain
1233              the match and sub-pattern matches.
1234       string = pattern
1235              Same as == above, but is obsolete.
1236       string != pattern
1237              True, if string does not match pattern.  When the string matches
1238              the pattern the .sh.match array variable will contain the  match
1239              and sub-pattern matches.
1240       string =∼ ere
1241              True  if  string  matches  the  pattern  ∼(E)ere where ere is an
1242              extended regular expression.
1243       string1 < string2
1244              True, if string1 comes before string2 based on  ASCII  value  of
1245              their characters.
1246       string1 > string2
1247              True,  if  string1  comes  after string2 based on ASCII value of
1248              their characters.
1249       The following obsolete arithmetic comparisons are also permitted:
1250       exp1 -eq exp2
1251              True, if exp1 is equal to exp2.
1252       exp1 -ne exp2
1253              True, if exp1 is not equal to exp2.
1254       exp1 -lt exp2
1255              True, if exp1 is less than exp2.
1256       exp1 -gt exp2
1257              True, if exp1 is greater than exp2.
1258       exp1 -le exp2
1259              True, if exp1 is less than or equal to exp2.
1260       exp1 -ge exp2
1261              True, if exp1 is greater than or equal to exp2.
1262
1263       In each of the above expressions, if file is  of  the  form  /dev/fd/n,
1264       where  n is an integer, then the test is applied to the open file whose
1265       descriptor number is n.
1266
1267       A compound expression can be constructed from these primitives by using
1268       any of the following, listed in decreasing order of precedence.
1269       (expression)
1270              True, if expression is true.  Used to group expressions.
1271       ! expression
1272              True if expression is false.
1273       expression1 && expression2
1274              True, if expression1 and expression2 are both true.
1275       expression1 ⎪⎪ expression2
1276              True, if either expression1 or expression2 is true.
1277
1278   Input/Output.
1279       Before  a  command  is executed, its input and output may be redirected
1280       using a special notation interpreted by the shell.  The  following  may
1281       appear  anywhere in a simple-command or may precede or follow a command
1282       and are not passed on to the invoked  command.   Command  substitution,
1283       parameter  expansion,  and arithmetic substitution occur before word or
1284       digit is used except as noted below.  File name generation occurs  only
1285       if  the  shell  is  interactive  and the pattern matches a single file.
1286       Field splitting is not performed.
1287
1288       In each  of  the  following  redirections,  if  file  is  of  the  form
1289       /dev/sctp/host/port,  /dev/tcp/host/port,  or /dev/udp/host/port, where
1290       host is a hostname or host address, and port is a service given by name
1291       or an integer port number, then the redirection attempts to make a tcp,
1292       sctp or udp connection to the corresponding socket.
1293
1294       No intervening space is allowed between the characters  of  redirection
1295       operators.
1296
1297       <word         Use file word as standard input (file descriptor 0).
1298
1299       >word         Use file word as standard output (file descriptor 1).  If
1300                     the file does not exist then it is created.  If the  file
1301                     exists,  and  the  noclobber option is on, this causes an
1302                     error; otherwise, it is truncated to zero length.
1303
1304       >|word        Same as >, except that it overrides the noclobber option.
1305
1306       >;word        Write output to a temporary file.  If  the  command  com‐
1307                     pletes  successfully rename it to word, otherwise, delete
1308                     the temporary file.   >;word  cannot  be  used  with  the
1309                     exec(2).  built-in.
1310
1311       >>word        Use  file  word  as standard output.  If the file exists,
1312                     then output is appended to it (by first  seeking  to  the
1313                     end-of-file); otherwise, the file is created.
1314
1315       <>word        Open  file  word for reading and writing as standard out‐
1316                     put.
1317
1318       <>;word       The same as <>word except that if the  command  completes
1319                     successfully,  word is truncated to the offset at command
1320                     completion.  <>;word cannot be  used  with  the  exec(2).
1321                     built-in.
1322
1323       <<[-]word     The  shell input is read up to a line that is the same as
1324                     word after any quoting has been removed, or to an end-of-
1325                     file.   No  parameter substitution, command substitution,
1326                     arithmetic substitution or file name generation  is  per‐
1327                     formed  on  word.  The resulting document, called a here-
1328                     document, becomes the standard input.  If  any  character
1329                     of  word is quoted, then no interpretation is placed upon
1330                     the characters  of  the  document;  otherwise,  parameter
1331                     expansion, command substitution, and arithmetic substitu‐
1332                     tion occur, \new-line is ignored, and \ must be  used  to
1333                     quote  the  characters  \, $, `.  If - is appended to <<,
1334                     then all leading tabs are stripped from word and from the
1335                     document.   If  #  is appended to <<, then leading spaces
1336                     and tabs will be stripped off the first line of the docu‐
1337                     ment and up to an equivalent indentation will be stripped
1338                     from the remaining lines and from word.  A  tab  stop  is
1339                     assumed  to  occur at every 8 columns for the purposes of
1340                     determining the indentation.
1341
1342       <<<word       A short form of here document in which word  becomes  the
1343                     contents  of the here-document after any parameter expan‐
1344                     sion, command substitution, and  arithmetic  substitution
1345                     occur.
1346
1347       <&digit       The  standard  input  is  duplicated from file descriptor
1348                     digit (see dup(2)).  Similarly for  the  standard  output
1349                     using >&digit.
1350
1351       <&digit-      The  file  descriptor given by digit is moved to standard
1352                     input.  Similarly for the standard output using >&digit-.
1353
1354       <&-           The standard input is closed.  Similarly for the standard
1355                     output using >&-.
1356
1357       <&p           The input from the co-process is moved to standard input.
1358
1359       >&p           The output to the co-process is moved to standard output.
1360
1361       <#((expr))    Evaluate  arithmetic  expression  expr  and position file
1362                     descriptor 0 to the resulting value bytes from the  start
1363                     of  the  file.  The variables CUR and EOF evaluate to the
1364                     current offset and end-of-file offset  respectively  when
1365                     evaluating expr.
1366
1367       >#((offset))  The same as <# except applies to file descriptor 1.
1368
1369       <#pattern     Seeks  forward to the beginning of the next line contain‐
1370                     ing pattern.
1371
1372       <##pattern    The same as <# except that the portion of the  file  that
1373                     is skipped is copied to standard output.
1374
1375       If  one of the above is preceded by a digit, with no intervening space,
1376       then the file descriptor number referred to is that  specified  by  the
1377       digit (instead of the default 0 or 1).  If one of the above, other than
1378       >&- and the ># and <# forms, is preceded by {varname} with no interven‐
1379       ing  space,  then a file descriptor number > 10 will be selected by the
1380       shell and stored in the variable varname.  If >&- or the any of the  >#
1381       and  <# forms is preceded by {varname} the value of varname defines the
1382       file descriptor to close or position.  For example:
1383
1384              ... 2>&1
1385
1386       means file descriptor 2 is to be opened for writing as a  duplicate  of
1387       file descriptor 1 and
1388
1389              exec {n}<file
1390
1391       means  open  file  named file for reading and store the file descriptor
1392       number in variable n.
1393
1394       The order in which redirections  are  specified  is  significant.   The
1395       shell  evaluates  each  redirection  in  terms of the (file descriptor,
1396       file) association at the time of evaluation.  For example:
1397
1398              ... 1>fname 2>&1
1399
1400       first associates file descriptor 1 with file fname.  It then associates
1401       file descriptor 2 with the file associated with file descriptor 1 (i.e.
1402       fname).  If the order of redirections were reversed, file descriptor  2
1403       would  be  associated with the terminal (assuming file descriptor 1 had
1404       been) and then file descriptor 1 would be associated with file fname.
1405
1406       If a command is followed by & and job control is not active,  then  the
1407       default  standard  input  for  the command is the empty file /dev/null.
1408       Otherwise, the environment for the execution of a command contains  the
1409       file  descriptors  of  the  invoking  shell as modified by input/output
1410       specifications.
1411
1412   Environment.
1413       The environment (see environ(7)) is a list of name-value pairs that  is
1414       passed  to  an  executed  program  in the same way as a normal argument
1415       list.  The names must be  identifiers  and  the  values  are  character
1416       strings.  The shell interacts with the environment in several ways.  On
1417       invocation, the shell scans the environment and creates a variable  for
1418       each  name  found, giving it the corresponding value and attributes and
1419       marking it export.  Executed commands inherit the environment.  If  the
1420       user  modifies the values of these variables or creates new ones, using
1421       the export or typeset -x commands, they become part of the environment.
1422       The  environment  seen  by any executed command is thus composed of any
1423       name-value pairs originally inherited by the shell, whose values may be
1424       modified  by  the current shell, plus any additions which must be noted
1425       in export or typeset -x commands.
1426
1427       The environment for any simple-command or function may be augmented  by
1428       prefixing it with one or more variable assignments.  A variable assign‐
1429       ment argument is a word of the form identifier=value.  Thus:
1430
1431              TERM=450 cmd args                  and
1432              (export TERM; TERM=450; cmd args)
1433
1434       are equivalent (as far as the  above  execution  of  cmd  is  concerned
1435       except for special built-in commands listed below - those that are pre‐
1436       ceded with a dagger).
1437
1438       If the obsolete -k option is set, all variable assignment arguments are
1439       placed  in  the environment, even if they occur after the command name.
1440       The following first prints a=b c and then c:
1441
1442              echo a=b c
1443              set -k
1444              echo a=b c
1445       This feature is intended for use with scripts written  for  early  ver‐
1446       sions  of the shell and its use in new scripts is strongly discouraged.
1447       It is likely to disappear someday.
1448
1449   Functions.
1450       For historical reasons, there are two ways  to  define  functions,  the
1451       name()  syntax  and the function name syntax, described in the Commands
1452       section above.  Shell functions are  read  in  and  stored  internally.
1453       Alias names are resolved when the function is read.  Functions are exe‐
1454       cuted like commands with the arguments passed as positional parameters.
1455       (See Execution below.)
1456
1457       Functions  defined  by the function name syntax and called by name exe‐
1458       cute in the same process as the caller and share all files and  present
1459       working  directory  with  the  caller.   Traps caught by the caller are
1460       reset to their default action inside the function.   A  trap  condition
1461       that  is  not  caught or ignored by the function causes the function to
1462       terminate and the condition to be passed on to the caller.  A  trap  on
1463       EXIT set inside a function is executed in the environment of the caller
1464       after the function completes.  Ordinarily, variables are shared between
1465       the  calling  program  and  the function.  However, the typeset special
1466       built-in command used within a function defines local  variables  whose
1467       scope  includes  the current function.  They can be passed to functions
1468       that they call in the variable assignment list that precedes  the  call
1469       or  as  arguments  passed  as name references.  Errors within functions
1470       return control to the caller.
1471
1472       Functions defined with the name() syntax and functions defined with the
1473       function  name syntax that are invoked with the .  special built-in are
1474       executed in the caller's environment and share all variables and  traps
1475       with  the  caller.   Errors  within these function executions cause the
1476       script that contains them to abort.
1477
1478       The special built-in command return is used  to  return  from  function
1479       calls.
1480
1481       Function  names  can  be listed with the -f or +f option of the typeset
1482       special built-in command.  The text of functions, when available,  will
1483       also  be listed with -f.  Functions can be undefined with the -f option
1484       of the unset special built-in command.
1485
1486       Ordinarily, functions are unset when the shell executes a shell script.
1487       Functions  that  need  to be defined across separate invocations of the
1488       shell should be placed in a directory and  the  FPATH  variable  should
1489       contain  the name of this directory.  They may also be specified in the
1490       ENV file.
1491
1492   Discipline Functions.
1493       Each variable can have zero or  more  discipline  functions  associated
1494       with  it.   The  shell  initially understands the discipline names get,
1495       set, append, and unset but can be added when defining  new  types.   On
1496       most  systems  others  can  be  added at run time via the C programming
1497       interface extension provided by the builtin built-in utility.   If  the
1498       get  discipline  is  defined for a variable, it is invoked whenever the
1499       given variable is referenced.  If the variable .sh.value is assigned  a
1500       value  inside  the  discipline  function,  the referenced variable will
1501       evaluate to this value instead.  If the set discipline is defined for a
1502       variable,  it  is  invoked  whenever  the  given variable is assigned a
1503       value.  If the append discipline is  defined  for  a  variable,  it  is
1504       invoked  whenever a value is appended to the given variable.  The vari‐
1505       able .sh.value is given the value of the variable before  invoking  the
1506       discipline,  and  the  variable will be assigned the value of .sh.value
1507       after the discipline completes.  If .sh.value is unset inside the  dis‐
1508       cipline,  then  that  value  is  unchanged.  If the unset discipline is
1509       defined for a variable, it is invoked whenever the  given  variable  is
1510       unset.   The  variable  will not be unset unless it is unset explicitly
1511       from within this discipline function.
1512
1513       The variable .sh.name contains the name of the variable for  which  the
1514       discipline  function  is  called, .sh.subscript is the subscript of the
1515       variable, and .sh.value will contain the value  being  assigned  inside
1516       the  set  discipline  function.   The  variable _ is a reference to the
1517       variable including the subscript  if  any.   For  the  set  discipline,
1518       changing  .sh.value will change the value that gets assigned.  Finally,
1519       the expansion ${var.name}, when name is the name of a  discipline,  and
1520       there is no variable of this name, is equivalent to the command substi‐
1521       tution ${ var.name;}.
1522
1523
1524   Name Spaces.
1525       Commands and functions that are executed as  part  of  the  list  of  a
1526       namespace  command  that  modify variables or create new ones, create a
1527       new variable whose name is the name of the name space as given by iden‐
1528       tifier  preceded  by  ..   When a variable whose name is name is refer‐
1529       enced, it is first searched for using .identifier.name.   Similarly,  a
1530       function  defined  by  a command in the namespace list is created using
1531       the name space name  preceded by a ..
1532
1533       When  the list of a namespace command contains a namespace command, the
1534       names  of variables and functions that are created consist of the vari‐
1535       able or function name preceded by the list of identifiers each preceded
1536       by ..
1537
1538       Outside  of  a name space, a variable or function created inside a name
1539       space can be referenced by preceding it with the name space name.
1540
1541       By default, variables staring with .sh are in the sh name space.
1542
1543
1544   Type Variables.
1545       Typed variables provide a way to create data structure and objects.   A
1546       type  can  be  defined either by a shared library, by the enum built-in
1547       command described below, or by using the new -T option of  the  typeset
1548       built-in command.  With the -T option of typeset, the type name, speci‐
1549       fied as an option argument to -T,  is  set  with  a  compound  variable
1550       assignment  that  defines  the  type.   Function definitions can appear
1551       inside the compound variable assignment  and  these  become  discipline
1552       functions  for  this  type  and  can  be  invoked  or redefined by each
1553       instance of the type.  The function name create is  treated  specially.
1554       It  is invoked for each instance of the type that is created but is not
1555       inherited and cannot be redefined for each instance.
1556
1557       When a type is defined a special  built-in  command  of  that  name  is
1558       added.   These  built-ins  are declaration commands and follow the same
1559       expansion rules as all the special built-in commands defined below that
1560       are  preceded  by  ††.   These commands can subsequently be used inside
1561       further type definitions.  The man page for these commands can be  gen‐
1562       erated  by  using  the  --man  option  or  any  of the other -- options
1563       described with getopts.  The -r, -a, -A, -h, and -S options of  typeset
1564       are permitted with each of these new built-ins.
1565
1566       An  instance of a type is created by invoking the type name followed by
1567       one or more instance names.  Each instance of the type  is  initialized
1568       with  a  copy  of  the  sub-variables except for sub-variables that are
1569       defined with the -S option.  Variables defined with the -S  are  shared
1570       by  all  instances  of the type.  Each instance can change the value of
1571       any sub-variable and can also define new discipline  functions  of  the
1572       same names as those defined by the type definition as well as any stan‐
1573       dard discipline names.  No additional sub-variables can be defined  for
1574       any instance.
1575
1576       When defining a type, if the value of a sub-variable is not set and the
1577       -r attribute is specified, it causes the sub-variable to be a  required
1578       sub-variable.   Whenever an instance of a type is created, all required
1579       sub-variables must be specified.  These sub-variables  become  readonly
1580       in each instance.
1581
1582       When  unset  is  invoked  on  a  sub-variable within a type, and the -r
1583       attribute has not been specified for this field, the value is reset  to
1584       the  default value associative with the type.  Invoking unset on a type
1585       instance not contained within another type  deletes  all  sub-variables
1586       and the variable itself.
1587
1588       A type definition can be derived from another type definition by defin‐
1589       ing the first sub-variable name as _ and defining its type as the  base
1590       type.   Any  remaining  definitions will be additions and modifications
1591       that apply to the new type.  If the new type name is the same  is  that
1592       of  the base type, the type will be replaced and the original type will
1593       no longer be accessible.
1594
1595       The typeset command with the -T and no option argument or operands will
1596       write  all  the type definitions to standard output in a form that that
1597       can be read in to create all they types.
1598
1599   Jobs.
1600       If the monitor option of the set command is turned on,  an  interactive
1601       shell associates a job with each pipeline.  It keeps a table of current
1602       jobs, printed by the jobs command, and assigns them small integer  num‐
1603       bers.   When a job is started asynchronously with &, the shell prints a
1604       line which looks like:
1605
1606            [1] 1234
1607
1608       indicating that the job which was started asynchronously was job number
1609       1 and had one (top-level) process, whose process id was 1234.
1610
1611       This  paragraph  and the next require features that are not in all ver‐
1612       sions of UNIX and may not apply.  If you are running a job and wish  to
1613       do something else you may hit the key ^Z (control-Z) which sends a STOP
1614       signal to the current job.  The shell will then normally indicate  that
1615       the  job  has  been  `Stopped', and print another prompt.  You can then
1616       manipulate the state of this job, putting it in the background with the
1617       bg  command,  or  run some other commands and then eventually bring the
1618       job back into the foreground with the  foreground  command  fg.   A  ^Z
1619       takes  effect immediately and is like an interrupt in that pending out‐
1620       put and unread input are discarded when it is typed.
1621
1622       A job being run in the background will stop if it tries  to  read  from
1623       the  terminal.  Background jobs are normally allowed to produce output,
1624       but this can be disabled by giving the command stty tostop.  If you set
1625       this  tty  option, then background jobs will stop when they try to pro‐
1626       duce output like they do when they try to read input.
1627
1628       A job pool is a collection of jobs started with list & associated  with
1629       a name.
1630
1631       There  are  several  ways  to refer to jobs in the shell.  A job can be
1632       referred to by the process id of any process of the job or  by  one  of
1633       the following:
1634       %number
1635              The job with the given number.
1636       pool   All the jobs in the job pool named by pool.
1637       pool.number
1638              The job number number in the job pool named by pool.
1639       %string
1640              Any job whose command line begins with string.
1641       %?string
1642              Any job whose command line contains string.
1643       %%     Current job.
1644       %+     Equivalent to %%.
1645       %-     Previous  job.   In addition, unless noted otherwise, wherever a
1646              job can be specified, the name of a background job pool  can  be
1647              used to represent all the jobs in that pool.
1648
1649       The shell learns immediately whenever a process changes state.  It nor‐
1650       mally informs you whenever a job becomes blocked  so  that  no  further
1651       progress is possible, but only just before it prints a prompt.  This is
1652       done so that it does not  otherwise  disturb  your  work.   The  notify
1653       option  of  the  set command causes the shell to print these job change
1654       messages as soon as they occur.
1655
1656       When the monitor option is on, each background job that completes trig‐
1657       gers any trap set for CHLD.
1658
1659       When  you try to leave the shell while jobs are running or stopped, you
1660       will be warned that `You have stopped(running) jobs.'  You may use  the
1661       jobs  command  to  see  what  they are.  If you immediately try to exit
1662       again, the shell will not warn you a second time, and the stopped  jobs
1663       will be terminated.  When a login shell receives a HUP signal, it sends
1664       a HUP signal to each job that has not been  disowned  with  the  disown
1665       built-in command described below.
1666
1667   Signals.
1668       The INT and QUIT signals for an invoked command are ignored if the com‐
1669       mand is followed by & and the monitor  option  is  active.   Otherwise,
1670       signals have the values inherited by the shell from its parent (but see
1671       also the trap built-in command below).
1672
1673   Execution.
1674       Each time a command is read, the above substitutions are  carried  out.
1675       If the command name matches one of the Special Built-in Commands listed
1676       below, it is executed within the current shell process.  Next, the com‐
1677       mand  name is checked to see if it matches a user defined function.  If
1678       it does, the positional parameters are saved  and  then  reset  to  the
1679       arguments  of  the  function  call.  A function is also executed in the
1680       current shell process.  When the function completes or issues a return,
1681       the  positional parameter list is restored.  For functions defined with
1682       the function name syntax, any trap set on EXIT within the  function  is
1683       executed.   The  exit value of a function is the value of the last com‐
1684       mand executed.  If a command name is not a special built-in command  or
1685       a  user defined function, but it is one of the built-in commands listed
1686       below, it is executed in the current shell process.
1687
1688       The shell variables PATH followed by the  variable  FPATH  defines  the
1689       list of directories to search for the command name.  Alternative direc‐
1690       tory names are separated by a colon (:).  The default path is equal  to
1691       getconf PATH  output.  The current directory can be specified by two or
1692       more adjacent colons, or by a colon at the beginning or end of the path
1693       list.   If  the  command name contains a /, then the search path is not
1694       used.  Otherwise, each directory in the list of directories defined  by
1695       PATH and FPATH is checked in order.  If the directory being searched is
1696       contained in FPATH and contains a file whose name matches  the  command
1697       being  searched,  then this file is loaded into the current shell envi‐
1698       ronment as if it were the argument to the . command  except  that  only
1699       preset  aliases  are expanded, and a function of the given name is exe‐
1700       cuted as described above.
1701
1702       If this directory is not in FPATH the shell  first  determines  whether
1703       there is a built-in version of a command corresponding to a given path‐
1704       name and if so it is invoked in the current process.  If no built-in is
1705       found,  the shell checks for a file named .paths in this directory.  If
1706       found and there is a line of the form FPATH=path where  path  names  an
1707       existing  directory  then  that directory is searched after immediately
1708       after the current directory as if it were found in the FPATH  variable.
1709       If path does not begin with /, it is checked for relative to the direc‐
1710       tory being searched.
1711
1712       The .paths file is then checked  for a line of the form PLUGIN_LIB=lib‐
1713       name  [  :  libname  ]  ...  .   Each  library named by libname will be
1714       searched for as if it were an option argument to builtin -f, and if  it
1715       contains a built-in of the specified name this will be executed instead
1716       of a command by this name.  Any built-in loaded from  a  library  found
1717       this  way  will  be associated with the directory containing the .paths
1718       file so it will only execute if not found in an earlier directory.
1719
1720       Finally, the directory will be checked for a file of  the  given  name.
1721       If  the  file  has  execute  permission but is not an a.out file, it is
1722       assumed to be a file containing shell commands.  A  separate  shell  is
1723       spawned  to  read  it.   All non-exported variables are removed in this
1724       case.  If the shell command file doesn't have read  permission,  or  if
1725       the  setuid and/or setgid bits are set on the file, then the shell exe‐
1726       cutes an agent whose job it is to set up the  permissions  and  execute
1727       the  shell with the shell command file passed down as an open file.  If
1728       the .paths contains a line of the form name=value in the first or  sec‐
1729       ond  line, then the environment variable name is modified by prepending
1730       the directory specified by value to the directory list.   If  value  is
1731       not  an  absolute  directory, then it specifies a directory relative to
1732       the directory that the executable was found.  If the environment  vari‐
1733       able  name  does  not already exist it will be added to the environment
1734       list for the specified command.  A parenthesized command is executed in
1735       a sub-shell without removing non-exported variables.
1736
1737   Command Re-entry.
1738       The  text  of  the  last HISTSIZE (default 512) commands entered from a
1739       terminal device is saved in a history file.  The file $HOME/.sh_history
1740       is  used if the HISTFILE variable is not set or if the file it names is
1741       not writable.  A shell can  access  the  commands  of  all  interactive
1742       shells which use the same named HISTFILE.  The built-in command hist is
1743       used to list or edit a portion of this file.  The portion of  the  file
1744       to be edited or listed can be selected by number or by giving the first
1745       character or characters of the command.  A single command or  range  of
1746       commands  can be specified.  If you do not specify an editor program as
1747       an argument to hist then the value of the variable  HISTEDIT  is  used.
1748       If  HISTEDIT is unset, the obsolete variable FCEDIT is used.  If FCEDIT
1749       is not defined, then /bin/ed is used.  The edited command(s) is printed
1750       and  re-executed  upon leaving the editor unless you quit without writ‐
1751       ing.  The -s option (and in obsolete versions, the editor  name  -)  is
1752       used  to skip the editing phase and to re-execute the command.  In this
1753       case a substitution parameter of the form old=new can be used to modify
1754       the  command  before  execution.  For example, with the preset alias r,
1755       which is aliased to ′hist -s′, typing `r bad=good  c'  will  re-execute
1756       the  most  recent command which starts with the letter c, replacing the
1757       first occurrence of the string bad with the string good.
1758
1759   In-line Editing Options.
1760       Normally, each command line entered from a terminal  device  is  simply
1761       typed  followed by a new-line (`RETURN' or `LINE FEED').  If either the
1762       emacs, gmacs, or vi option is active, the user  can  edit  the  command
1763       line.   To  be  in  either  of  these  edit modes set the corresponding
1764       option.  An editing option is automatically selected each time the VIS‐
1765       UAL  or  EDITOR  variable is assigned a value ending in either of these
1766       option names.
1767
1768       The editing features require that the user's terminal  accept  `RETURN'
1769       as  carriage return without line feed and that a space (` ') must over‐
1770       write the current character on the screen.
1771
1772       Unless the multiline option is on, the editing modes implement  a  con‐
1773       cept  where  the  user is looking through a window at the current line.
1774       The window width is the value of COLUMNS if it  is  defined,  otherwise
1775       80.   If  the window width is too small to display the prompt and leave
1776       at least 8 columns to enter input, the prompt  is  truncated  from  the
1777       left.  If the line is longer than the window width minus two, a mark is
1778       displayed at the end of the window to notify the user.  As  the  cursor
1779       moves  and  reaches  the  window boundaries the window will be centered
1780       about the cursor.  The mark is a > (<, *) if the line  extends  on  the
1781       right (left, both) side(s) of the window.
1782
1783       The  search  commands  in  each edit mode provide access to the history
1784       file.  Only strings are matched, not patterns, although a leading ^  in
1785       the  string  restricts the match to begin at the first character in the
1786       line.
1787
1788       Each of the edit modes has an operation to list the files  or  commands
1789       that match a partially entered word.  When applied to the first word on
1790       the line, or the first word after a ;, , &, or (, and  the  word  does
1791       not  begin  with  or contain a /, the list of aliases, functions, and
1792       executable commands defined by the PATH variable that could  match  the
1793       partial word is displayed.  Otherwise, the list of files that match the
1794       given word is displayed.  If the partially entered word does  not  con‐
1795       tain  any  file expansion characters, a * is appended before generating
1796       these lists.  After displaying the generated list, the  input  line  is
1797       redrawn.   These  operations  are  called command name listing and file
1798       name listing, respectively.  There are additional operations,  referred
1799       to  as  command name completion and file name completion, which compute
1800       the list of matching commands or files, but  instead  of  printing  the
1801       list,  replace  the current word with a complete or partial match.  For
1802       file name completion, if the match is unique, a / is  appended  if  the
1803       file is a directory and a space is appended if the file is not a direc‐
1804       tory.  Otherwise, the longest common prefix for all the matching  files
1805       replaces  the  word.   For command name completion, only the portion of
1806       the file names after the last / are used to find  the  longest  command
1807       prefix.   If  only  a single name matches this prefix, then the word is
1808       replaced with the command name followed by a space.  When using  a  tab
1809       for  completion  that  does  not yield a unique match, a subsequent tab
1810       will provide a numbered list  of  matching  alternatives.   A  specific
1811       selection  can  be  made by entering the selection number followed by a
1812       tab.
1813
1814   Key Bindings.
1815       The KEYBD trap can be used to intercept keys  as  they  are  typed  and
1816       change  the  characters that are actually seen by the shell.  This trap
1817       is executed after each character (or sequence of  characters  when  the
1818       first  character is ESC) is entered while reading from a terminal.  The
1819       variable .sh.edchar contains the character or character sequence  which
1820       generated  the  trap.   Changing  the  value  of .sh.edchar in the trap
1821       action causes the shell to behave as if the new value were entered from
1822       the keyboard rather than the original value.
1823
1824       The  variable .sh.edcol is set to the input column number of the cursor
1825       at the time of the input.  The variable .sh.edmode is set to  ESC  when
1826       in  vi  insert  mode  (see below) and is null otherwise.  By prepending
1827       ${.sh.editmode} to a value assigned to .sh.edchar  it  will  cause  the
1828       shell to change to control mode if it is not already in this mode.
1829
1830       This trap is not invoked for characters entered as arguments to editing
1831       directives, or while reading input for a character search.
1832
1833   Emacs Editing Mode.
1834       This mode is entered by enabling either the emacs or gmacs option.  The
1835       only  difference between these two modes is the way they handle ^T.  To
1836       edit, the user moves the cursor to the  point  needing  correction  and
1837       then inserts or deletes characters or words as needed.  All the editing
1838       commands are control characters or escape sequences.  The notation  for
1839       control  characters  is caret (^) followed by the character.  For exam‐
1840       ple, ^F is the notation for control F.  This is entered  by  depressing
1841       `f'  while  holding  down the `CTRL' (control) key.  The `SHIFT' key is
1842       not depressed.  (The notation ^?  indicates the DEL (delete) key.)
1843
1844       The notation for escape sequences is M- followed by a  character.   For
1845       example,  M-f  (pronounced  Meta f) is entered by depressing ESC (ascii
1846       033) followed by `f'.  (M-F would be the notation for ESC  followed  by
1847       `SHIFT' (capital) `F'.)
1848
1849       All  edit  commands operate from any place on the line (not just at the
1850       beginning).  Neither the `RETURN' nor the `LINE FEED'  key  is  entered
1851       after edit commands except when noted.
1852
1853       ^F        Move cursor forward (right) one character.
1854       M-[C      Move cursor forward (right) one character.
1855       M-f       Move  cursor forward one word.  (The emacs editor's idea of a
1856                 word is a string of characters consisting  of  only  letters,
1857                 digits and underscores.)
1858       ^B        Move cursor backward (left) one character.
1859       M-[D      Move cursor backward (left) one character.
1860       M-b       Move cursor backward one word.
1861       ^A        Move cursor to start of line.
1862       M-[H      Move cursor to start of line.
1863       ^E        Move cursor to end of line.
1864       M-[Y      Move cursor to end of line.
1865       ^]char    Move cursor forward to character char on current line.
1866       M-^]char  Move cursor backward to character char on current line.
1867       ^X^X      Interchange the cursor and mark.
1868       erase     (User  defined erase character as defined by the stty(1) com‐
1869                 mand, usually ^H or #.)  Delete previous character.
1870       lnext     (User defined  literal  next  character  as  defined  by  the
1871                 stty(1)  command,  or  ^V  if not defined.)  Removes the next
1872                 character's editing features (if any).
1873       ^D        Delete current character.
1874       M-d       Delete current word.
1875       M-^H      (Meta-backspace) Delete previous word.
1876       M-h       Delete previous word.
1877       M-^?      (Meta-DEL) Delete previous word (if your interrupt  character
1878                 is ^?  (DEL, the default) then this command will not work).
1879       ^T        Transpose  current  character  with  previous  character  and
1880                 advance the cursor in emacs  mode.   Transpose  two  previous
1881                 characters in gmacs mode.
1882       ^C        Capitalize current character.
1883       M-c       Capitalize current word.
1884       M-l       Change the current word to lower case.
1885       ^K        Delete  from  the cursor to the end of the line.  If preceded
1886                 by a numerical parameter whose value is less than the current
1887                 cursor  position,  then  delete from given position up to the
1888                 cursor.  If preceded by a numerical parameter whose value  is
1889                 greater  than  the  current cursor position, then delete from
1890                 cursor up to given cursor position.
1891       ^W        Kill from the cursor to the mark.
1892       M-p       Push the region from the cursor to the mark on the stack.
1893       kill      (User defined kill character as defined by the stty  command,
1894                 usually ^G or @.)  Kill the entire current line.  If two kill
1895                 characters are entered in  succession,  all  kill  characters
1896                 from  then on cause a line feed (useful when using paper ter‐
1897                 minals).
1898       ^Y        Restore last item removed from line. (Yank item back  to  the
1899                 line.)
1900       ^L        Line feed and print current line.
1901       M-^L      Clear the screen.
1902       ^@        (Null character) Set mark.
1903       M-space   (Meta space) Set mark.
1904       ^J        (New line) Execute the current line.
1905       ^M        (Return) Execute the current line.
1906       eof       End-of-file  character,  normally ^D, is processed as an End-
1907                 of-file only if the current line is null.
1908       ^P        Fetch previous command.  Each time ^P is entered the previous
1909                 command  back  in time is accessed.  Moves back one line when
1910                 not on the first line of a multi-line command.
1911       M-[A      If the cursor is at the end of the line, it is equivalent  to
1912                 ^R with string set to the contents of the current line.  Oth‐
1913                 erwise, it is equivalent to ^P.
1914       M-<       Fetch the least recent (oldest) history line.
1915       M->       Fetch the most recent (youngest) history line.
1916       ^N        Fetch next command line.  Each time ^N is  entered  the  next
1917                 command line forward in time is accessed.
1918       M-[B      Equivalent to ^N.
1919       ^Rstring  Reverse search history for a previous command line containing
1920                 string.  If a parameter of zero is given, the search is  for‐
1921                 ward.   String is terminated by a `RETURN' or `NEW LINE'.  If
1922                 string is preceded by a ^, the matched line must  begin  with
1923                 string.   If  string  is  omitted, then the next command line
1924                 containing the most recent string is accessed.  In this  case
1925                 a parameter of zero reverses the direction of the search.
1926       ^O        Operate  -  Execute  the current line and fetch the next line
1927                 relative to current line from the history file.
1928       M-digits  (Escape) Define numeric parameter, the digits are taken as  a
1929                 parameter  to  the  next command.  The commands that accept a
1930                 parameter are ^F, ^B, erase, ^C, ^D, ^K, ^R, ^P, ^N, ^], M-.,
1931                 M-^], M-_, M-=, M-b, M-c, M-d, M-f, M-h, M-l and M-^H.
1932       M-letter  Soft-key  -  Your  alias list is searched for an alias by the
1933                 name _letter and if an alias of this  name  is  defined,  its
1934                 value  will  be inserted on the input queue.  The letter must
1935                 not be one of the above meta-functions.
1936       M-[letter Soft-key - Your alias list is searched for an  alias  by  the
1937                 name  __letter  and  if an alias of this name is defined, its
1938                 value will be inserted on the input queue.  This can be  used
1939                 to program function keys on many terminals.
1940       M-.       The  last  word  of  the  previous command is inserted on the
1941                 line.  If preceded by a numeric parameter, the value of  this
1942                 parameter  determines  which  word  to insert rather than the
1943                 last word.
1944       M-_       Same as M-..
1945       M-*       Attempt file name generation on the current word.  An  aster‐
1946                 isk is appended if the word doesn't match any file or contain
1947                 any special pattern characters.
1948       M-ESC     Command or file name completion as described above.
1949       ^I tab    Attempts command or file name completion as described  above.
1950                 If a partial completion occurs, repeating this will behave as
1951                 if M-= were entered.  If no match is found or  entered  after
1952                 space, a tab is inserted.
1953       M-=       If not preceded by a numeric parameter, it generates the list
1954                 of matching commands or file names as described above.   Oth‐
1955                 erwise,  the  word  under  the cursor is replaced by the item
1956                 corresponding to the value of the numeric parameter from  the
1957                 most  recently generated command or file list.  If the cursor
1958                 is not on a word, it is inserted instead.
1959       ^U        Multiply parameter of next command by 4.
1960       \         Escape next character.  Editing characters, the user's erase,
1961                 kill  and  interrupt (normally ^?)  characters may be entered
1962                 in a command line or in a search string if preceded by  a  \.
1963                 The \ removes the next character's editing features (if any).
1964       M-^V      Display version of the shell.
1965       M-#       If  the  line does not begin with a #, a # is inserted at the
1966                 beginning of the line and after each new-line, and  the  line
1967                 is entered.  This causes a comment to be inserted in the his‐
1968                 tory file.  If the line begins with a #, the # is deleted and
1969                 one # after each new-line is also deleted.
1970
1971   Vi Editing Mode.
1972       There  are  two  typing modes.  Initially, when you enter a command you
1973       are in the input mode.  To edit, the user enters control mode by typing
1974       ESC (033) and moves the cursor to the point needing correction and then
1975       inserts or deletes characters or words as needed.   Most  control  com‐
1976       mands accept an optional repeat count prior to the command.
1977
1978       When  in  vi  mode  on  most systems, canonical processing is initially
1979       enabled and the command will be echoed again if the speed is 1200  baud
1980       or greater and it contains any control characters or less than one sec‐
1981       ond has elapsed since the prompt was printed.  The ESC character termi‐
1982       nates  canonical  processing  for  the remainder of the command and the
1983       user can then modify the command line.  This scheme has the  advantages
1984       of canonical processing with the type-ahead echoing of raw mode.
1985
1986       If  the option viraw is also set, the terminal will always have canoni‐
1987       cal processing disabled.  This mode is implicit for systems that do not
1988       support  two  alternate  end of line delimiters, and may be helpful for
1989       certain terminals.
1990
1991        Input Edit Commands
1992              By default the editor is in input mode.
1993              erase     (User defined erase character as defined by  the  stty
1994                        command, usually ^H or #.)  Delete previous character.
1995              ^W        Delete  the  previous  blank  separated word.  On some
1996                        systems the viraw option may be required for  this  to
1997                        work.
1998              eof       As the first character of the line causes the shell to
1999                        terminate unless the ignoreeof option is set.   Other‐
2000                        wise this character is ignored.
2001              lnext     (User defined literal next character as defined by the
2002                        stty(1) or ^V if not defined.)  Removes the next char‐
2003                        acter's  editing  features  (if any).  On some systems
2004                        the viraw option may be required for this to work.
2005              \         Escape the next erase or kill character.
2006              ^I tab    Attempts command or file name completion as  described
2007                        above and returns to input mode.  If a partial comple‐
2008                        tion occurs, repeating this will behave as if  =  were
2009                        entered  from  control  mode.  If no match is found or
2010                        entered after space, a tab is inserted.
2011        Motion Edit Commands
2012              These commands will move the cursor.
2013              [count]l  Cursor forward (right) one character.
2014              [count][C Cursor forward (right) one character.
2015              [count]w  Cursor forward one alpha-numeric word.
2016              [count]W  Cursor to the beginning of the next word that  follows
2017                        a blank.
2018              [count]e  Cursor to end of word.
2019              [count]E  Cursor to end of the current blank delimited word.
2020              [count]h  Cursor backward (left) one character.
2021              [count][D Cursor backward (left) one character.
2022              [count]b  Cursor backward one word.
2023              [count]B  Cursor to preceding blank separated word.
2024              [count]Cursor to column count.
2025              [count]fc Find the next character c in the current line.
2026              [count]Fc Find the previous character c in the current line.
2027              [count]tc Equivalent to f followed by h.
2028              [count]Tc Equivalent to F followed by l.
2029              [count];  Repeats  count  times,  the last single character find
2030                        command, f, F, t, or T.
2031              [count],  Reverses the last single character find command  count
2032                        times.
2033              0         Cursor to start of line.
2034              ^         Cursor to start of line.
2035              [H        Cursor to first non-blank character in line.
2036              $         Cursor to end of line.
2037              [Y        Cursor to end of line.
2038              %         Moves  to balancing (, ), {, }, [, or ].  If cursor is
2039                        not on one of the above characters, the  remainder  of
2040                        the  line  is searched for the first occurrence of one
2041                        of the above characters first.
2042        Search Edit Commands
2043              These commands access your command history.
2044              [count]k  Fetch previous command.  Each time k  is  entered  the
2045                        previous command back in time is accessed.
2046              [count]-  Equivalent to k.
2047              [count][A If  cursor  is at the end of the line it is equivalent
2048                        to / with string^set to the contents  of  the  current
2049                        line.  Otherwise, it is equivalent to k.
2050              [count]j  Fetch  next  command.  Each time j is entered the next
2051                        command forward in time is accessed.
2052              [count]+  Equivalent to j.
2053              [count][B Equivalent to j.
2054              [count]G  The command number count is fetched.  The  default  is
2055                        the least recent history command.
2056              /string   Search backward through history for a previous command
2057                        containing string.  String is terminated by a `RETURN'
2058                        or  `NEW LINE'.   If  string  is  preceded by a ^, the
2059                        matched line must begin with  string.   If  string  is
2060                        null, the previous string will be used.
2061              ?string   Same  as  /  except that search will be in the forward
2062                        direction.
2063              n         Search for next match of the last pattern to  /  or  ?
2064                        commands.
2065              N         Search  for  next match of the last pattern to / or ?,
2066                        but in reverse direction.
2067        Text Modification Edit Commands
2068              These commands will modify the line.
2069              a         Enter input mode and  enter  text  after  the  current
2070                        character.
2071              A         Append text to the end of the line.  Equivalent to $a.
2072              [count]cmotion
2073              c[count]motion
2074                        Delete  current  character  through the character that
2075                        motion would move the cursor to and enter input  mode.
2076                        If  motion  is  c, the entire line will be deleted and
2077                        input mode entered.
2078              C         Delete the current character through the end  of  line
2079                        and enter input mode.  Equivalent to c$.
2080              S         Equivalent to cc.
2081              [count]s  Replace characters under the cursor in input mode.
2082              D         Delete  the current character through the end of line.
2083                        Equivalent to d$.
2084              [count]dmotion
2085              d[count]motion
2086                        Delete current character through  the  character  that
2087                        motion  would  move  to.   If motion is d , the entire
2088                        line will be deleted.
2089              i         Enter input mode and insert text  before  the  current
2090                        character.
2091              I         Insert text before the beginning of the line.  Equiva‐
2092                        lent to 0i.
2093              [count]P  Place the previous text modification before  the  cur‐
2094                        sor.
2095              [count]p  Place the previous text modification after the cursor.
2096              R         Enter  input mode and replace characters on the screen
2097                        with characters you type overlay fashion.
2098              [count]rc Replace the count character(s) starting at the current
2099                        cursor position with c, and advance the cursor.
2100              [count]x  Delete current character.
2101              [count]X  Delete preceding character.
2102              [count].  Repeat the previous text modification command.
2103              [count]Invert  the case of the count character(s) starting at
2104                        the current cursor position and advance the cursor.
2105              [count]_  Causes the count word of the previous  command  to  be
2106                        appended  and  input  mode  entered.  The last word is
2107                        used if count is omitted.
2108              *         Causes an * to be appended to  the  current  word  and
2109                        file name generation attempted.  If no match is found,
2110                        it rings the bell.  Otherwise, the word is replaced by
2111                        the matching pattern and input mode is entered.
2112              \         Command or file name completion as described above.
2113        Other Edit Commands
2114              Miscellaneous commands.
2115              [count]ymotion
2116              y[count]motion
2117                        Yank  current  character through character that motion
2118                        would move the cursor to and puts them into the delete
2119                        buffer.  The text and cursor are unchanged.
2120              yy        Yanks the entire line.
2121              Y         Yanks  from  current position to end of line.  Equiva‐
2122                        lent to y$.
2123              u         Undo the last text modifying command.
2124              U         Undo all the text modifying commands performed on  the
2125                        line.
2126              [count]v  Returns  the  command hist -e ${VISUAL:-${EDITOR:-vi}}
2127                        count in the input buffer.  If count is omitted,  then
2128                        the current line is used.
2129              ^L        Line  feed and print current line.  Has effect only in
2130                        control mode.
2131              ^J        (New line) Execute the  current  line,  regardless  of
2132                        mode.
2133              ^M        (Return) Execute the current line, regardless of mode.
2134              #         If  the  first  character  of the command is a #, then
2135                        this command deletes this # and each # that follows  a
2136                        newline.   Otherwise, sends the line after inserting a
2137                        # in front of each line in the  command.   Useful  for
2138                        causing the current line to be inserted in the history
2139                        as a comment  and  uncommenting  previously  commented
2140                        commands in the history file.
2141              [count]=  If  count  is  not specified, it generates the list of
2142                        matching commands or file names  as  described  above.
2143                        Otherwise,  the  word under the the cursor is replaced
2144                        by the count item from  the  most  recently  generated
2145                        command or file list.  If the cursor is not on a word,
2146                        it is inserted instead.
2147              @letter   Your alias list is searched for an alias by  the  name
2148                        _letter  and  if an alias of this name is defined, its
2149                        value will be inserted on the input queue for process‐
2150                        ing.
2151              ^V        Display version of the shell.
2152
2153   Built-in Commands.
2154       The  following  simple-commands  are  executed  in  the  shell process.
2155       Input/Output redirection is permitted.  Unless otherwise indicated, the
2156       output  is written on file descriptor 1 and the exit status, when there
2157       is no syntax error, is zero.  Except for :, true, false, echo,  newgrp,
2158       and  login, all built-in commands accept -- to indicate end of options.
2159       They also interpret the option --man as a request to  display  the  man
2160       page onto standard error and -?  as a help request which prints a usage
2161       message on standard error.  Commands that are preceded by one or two  †
2162       symbols  are special built-in commands and are treated specially in the
2163       following ways:
2164       1.     Variable assignment lists preceding the command remain in effect
2165              when the command completes.
2166       2.     I/O redirections are processed after variable assignments.
2167       3.     Errors cause a script that contains them to abort.
2168       4.     They are not valid function names.
2169       5.     Words  following a command preceded by †† that are in the format
2170              of a variable assignment are expanded with the same rules  as  a
2171              variable assignment.  This means that tilde substitution is per‐
2172              formed after the = sign and field splitting and file name gener‐
2173              ation  are  not  performed.  These are called declaration built-
2174              ins.
2175
2176: [ arg ... ]
2177              The command only expands parameters.
2178
2179. name [ arg ... ]
2180              If name is a function defined with the  function  name  reserved
2181              word syntax, the function is executed in the current environment
2182              (as if it had been defined with the name()  syntax.)   Otherwise
2183              if  name  refers to a file, the file is read in its entirety and
2184              the commands are executed in the current shell environment.  The
2185              search path specified by PATH is used to find the directory con‐
2186              taining the file.  If any arguments arg are given,  they  become
2187              the  positional  parameters  while processing the .  command and
2188              the original positional parameters are restored upon completion.
2189              Otherwise  the  positional  parameters  are unchanged.  The exit
2190              status is the exit status of the last command executed.
2191
2192       †† alias [ -ptx ]  [ name[ =value  ] ] ...
2193              alias with no arguments prints the list of aliases in  the  form
2194              name=value  on  standard  output.  The -p option causes the word
2195              alias to be inserted before each one.  When one  or  more  argu‐
2196              ments  are  given, an alias is defined for each name whose value
2197              is given.  A trailing space in value causes the next word to  be
2198              checked  for alias substitution.  The obsolete -t option is used
2199              to set and list tracked aliases.  The value of a  tracked  alias
2200              is the full pathname corresponding to the given name.  The value
2201              becomes undefined when the value of PATH is reset but the  alias
2202              remains  tracked.   Without  the -t option, for each name in the
2203              argument list for which no value is given, the name and value of
2204              the  alias  is  printed.   The obsolete -x option has no effect.
2205              The exit status is non-zero if a name is given,  but  no  value,
2206              and no alias has been defined for the name.
2207
2208       bg [ job... ]
2209              This  command is only on systems that support job control.  Puts
2210              each specified job into the background.  The current job is  put
2211              in  the  background  if  job  is  not specified.  See Jobs for a
2212              description of the format of job.
2213
2214break [ n ]
2215              Exit from the enclosing for, while, until, or  select  loop,  if
2216              any.  If n is specified, then break n levels.
2217
2218       builtin [ -ds ] [ -f file ] [ name ... ]
2219              If  name  is  not  specified, and no -f option is specified, the
2220              built-ins are printed on standard output.  The -s option  prints
2221              only the special built-ins.  Otherwise, each name represents the
2222              pathname whose basename is the name of the built-in.  The  entry
2223              point function name is determined by prepending b_ to the built-
2224              in name.  A built-in specified by a pathname will only  be  exe‐
2225              cuted  when that pathname would be found during the path search.
2226              Built-ins found in libraries loaded via the .paths file will  be
2227              associate  with  the  pathname  of  the directory containing the
2228              .paths file.
2229
2230       The ISO C/C++ prototype is b_mycommand(int  argc,  char  *argv[],  void
2231       *context)  for  the builtin command mycommand where argv is array an of
2232       argc elements and context is an optional pointer to a Shell_t structure
2233       as described in <ast/shell.h>.
2234       Special  built-ins  cannot  be  bound to a pathname or deleted.  The -d
2235       option deletes each of the given built-ins.  On  systems  that  support
2236       dynamic  loading,  the  -f option names a shared library containing the
2237       code for built-ins.  The shared library  prefix  and/or  suffix,  which
2238       depend  on  the  system, can be omitted.  Once a library is loaded, its
2239       symbols become available for subsequent invocations of builtin.  Multi‐
2240       ple libraries can be specified with separate invocations of the builtin
2241       command.  Libraries are searched in the reverse order in which they are
2242       specified.   When  a  library is loaded, it looks for a function in the
2243       library whose name is lib_init() and  invokes  this  function  with  an
2244       argument of 0.
2245
2246       cd [ -LP ] [ arg ]
2247       cd [ -LP ] old new
2248              This  command  can be in either of two forms.  In the first form
2249              it changes the current directory to arg.  If arg is - the direc‐
2250              tory  is  changed to the previous directory.  The shell variable
2251              HOME is the default arg.  The variable PWD is set to the current
2252              directory.   The  shell  variable CDPATH defines the search path
2253              for the directory containing arg.  Alternative  directory  names
2254              are separated by a colon (:).  The default path is <null> (spec‐
2255              ifying the current directory).  Note that the current  directory
2256              is  specified  by a null path name, which can appear immediately
2257              after the equal sign or between the  colon  delimiters  anywhere
2258              else  in  the path list.  If arg begins with a / then the search
2259              path is not used.  Otherwise, each  directory  in  the  path  is
2260              searched for arg.
2261              The  second form of cd substitutes the string new for the string
2262              old in the current directory name, PWD, and tries to  change  to
2263              this new directory.
2264              By default, symbolic link names are treated literally when find‐
2265              ing the directory name.  This is equivalent to  the  -L  option.
2266              The  -P  option causes symbolic links to be resolved when deter‐
2267              mining the directory.  The last instance of -L or -P on the com‐
2268              mand line determines which method is used.
2269              The cd command may not be executed by rksh.  rksh93.
2270
2271       command [ -pvxV ] name [ arg ... ]
2272              Without  the  -v  or  -V options, command executes name with the
2273              arguments given by arg.  The -p option causes a default path  to
2274              be  searched  rather  than the one defined by the value of PATH.
2275              Functions will not be searched for when finding name.  In  addi‐
2276              tion,  if name refers to a special built-in, none of the special
2277              properties associated with the leading daggers will be  honored.
2278              (For  example, the predefined alias redirect=′command exec′ pre‐
2279              vents a script from terminating when an invalid  redirection  is
2280              given.)   With  the -x option, if command execution would result
2281              in a failure because there are too many arguments, errno  E2BIG,
2282              the  shell will invoke command name multiple times with a subset
2283              of the arguments on each invocation.  Arguments that occur prior
2284              to  the  first word that expands to multiple arguments and after
2285              the last word that expands to multiple arguments will be  passed
2286              on each invocation.  The exit status will be the maximum invoca‐
2287              tion exit status.  With the -v option, command is equivalent  to
2288              the  built-in  whence  command  described  below.  The -V option
2289              causes command to act like whence -v.
2290
2291continue [ n ]
2292              Resume the next iteration of the enclosing for, while, until, or
2293              select loop.  If n is specified, then resume at the n-th enclos‐
2294              ing loop.
2295
2296       disown [ job... ]
2297              Causes the shell not to send a HUP signal to each given job,  or
2298              all  active  jobs  if  job is omitted, when a login shell termi‐
2299              nates.
2300
2301       echo [ arg ... ]
2302              When the first arg does not begin with a  -,  and  none  of  the
2303              arguments  contain  a  \, then echo prints each of its arguments
2304              separated by a space and terminated by a  new-line.   Otherwise,
2305              the  behavior  of  echo  is system dependent and print or printf
2306              described below should be  used.   See  echo(1)  for  usage  and
2307              description.
2308
2309       †† enum [ -i  ] type[=(value ...) ]
2310              Creates a declaration command named type that is an integer type
2311              that allows one of the specified values  as  enumeration  names.
2312              If  =(value ...)  is omitted, then type must be an indexed array
2313              variable with at least two elements and  the  values  are  taken
2314              from  this  array  variable.   If -i is specified the values are
2315              case insensitive.
2316
2317eval [ arg ... ]
2318              The arguments are read as input to the shell and  the  resulting
2319              command(s) executed.
2320
2321exec [ -c ] [ -a name ] [ arg ... ]
2322              If  arg is given, the command specified by the arguments is exe‐
2323              cuted in place of this shell without  creating  a  new  process.
2324              The -c option causes the environment to be cleared before apply‐
2325              ing variable assignments associated with  the  exec  invocation.
2326              The  -a  option causes name rather than the first arg, to become
2327              argv[0] for the new process.  Input/output arguments may  appear
2328              and affect the current process.  If arg is not given, the effect
2329              of this command is to modify file descriptors as  prescribed  by
2330              the  input/output  redirection  list.   In  this  case, any file
2331              descriptor numbers greater than 2  that  are  opened  with  this
2332              mechanism are closed when invoking another program.
2333
2334exit [ n ]
2335              Causes  the  shell  to exit with the exit status specified by n.
2336              The value will be the least significant 8 bits of the  specified
2337              status.   If  n  is omitted, then the exit status is that of the
2338              last command executed.  An end-of-file will also cause the shell
2339              to  exit  except for a shell which has the ignoreeof option (see
2340              set below) turned on.
2341
2342       †† export [ -p ] [ name[=value] ] ...
2343              If name is not given, the names and values of each variable with
2344              the  export  attribute  are  printed with the values quoted in a
2345              manner that allows them to be re-input.  The export  command  is
2346              the  same  as  typeset -x except that if you use export within a
2347              function, no local variable is created.  The  -p  option  causes
2348              the  word export to be inserted before each one.  Otherwise, the
2349              given names are marked for automatic export to  the  environment
2350              of subsequently-executed commands.
2351
2352       false  Does nothing, and exits 1. Used with until for infinite loops.
2353
2354       fg [ job... ]
2355              This  command is only on systems that support job control.  Each
2356              job specified is brought to the foreground and waited for in the
2357              specified order.  Otherwise, the current job is brought into the
2358              foreground.  See Jobs for a description of the format of job.
2359
2360       getconf [ name [ pathname ] ]
2361              Prints the current value of the configuration parameter given by
2362              name.   The  configuration  parameters  are  defined by the IEEE
2363              POSIX 1003.1 and IEEE POSIX 1003.2 standards.  (See  pathconf(2)
2364              and  sysconf(2).)  The pathname argument is required for parame‐
2365              ters whose value depends on the location in the file system.  If
2366              no  arguments  are given, getconf prints the names and values of
2367              the current configuration parameters.  The pathname  /  is  used
2368              for each of the parameters that requires pathname.
2369
2370       getopts [  -a name ] optstring vname [ arg ... ]
2371              Checks arg for legal options.  If arg is omitted, the positional
2372              parameters are used.  An option argument begins with a + or a -.
2373              An  option not beginning with + or - or the argument -- ends the
2374              options.  Options beginning with + are only recognized when opt‐
2375              string  begins  with  a  +.  optstring contains the letters that
2376              getopts recognizes.  If a letter is followed by a :, that option
2377              is  expected  to have an argument.  The options can be separated
2378              from the argument by blanks.  The option -?  causes  getopts  to
2379              generate a usage message on standard error.  The -a argument can
2380              be used to specify the name to use for the usage message,  which
2381              defaults to $0.
2382              getopts  places  the next option letter it finds inside variable
2383              vname each time it  is  invoked.   The  option  letter  will  be
2384              prepended  with  a + when arg begins with a +.  The index of the
2385              next arg is stored in OPTIND.  The option argument, if any, gets
2386              stored in OPTARG.
2387              A  leading  : in optstring causes getopts to store the letter of
2388              an invalid option in OPTARG, and to  set  vname  to  ?   for  an
2389              unknown option and to : when a required option argument is miss‐
2390              ing.  Otherwise, getopts prints an error message.  The exit sta‐
2391              tus is non-zero when there are no more options.
2392              There is no way to specify any of the options :, +, -, ?, [, and
2393              ].  The option # can only be specified as the first option.
2394
2395       hist [ -e ename  ] [ -nlr ] [ first [ last ] ]
2396       hist -s  [ old=new ] [ command ]
2397              In the first form, a range of commands from  first  to  last  is
2398              selected  from the last HISTSIZE commands that were typed at the
2399              terminal.  The arguments first and last may be  specified  as  a
2400              number  or  as  a  string.   A string is used to locate the most
2401              recent command starting with the given string.  A negative  num‐
2402              ber  is used as an offset to the current command number.  If the
2403              -l option is selected, the commands are listed on standard  out‐
2404              put.   Otherwise,  the editor program ename is invoked on a file
2405              containing these keyboard commands.  If ename is  not  supplied,
2406              then the value of the variable HISTEDIT is used.  If HISTEDIT is
2407              not set, then FCEDIT (default /bin/ed) is used  as  the  editor.
2408              When  editing  is complete, the edited command(s) is executed if
2409              the changes have been saved.  If last is not specified, then  it
2410              will be set to first.  If first is not specified, the default is
2411              the previous command for  editing  and  -16  for  listing.   The
2412              option  -r  reverses the order of the commands and the option -n
2413              suppresses command numbers when listing.  In  the  second  form,
2414              command  is interpreted as first described above and defaults to
2415              the last command executed.  The resulting  command  is  executed
2416              after the optional substitution old=new is performed.
2417
2418       jobs [ -lnp ] [ job ... ]
2419              Lists  information  about  each given job; or all active jobs if
2420              job is omitted.  The -l option lists process ids in addition  to
2421              the  normal  information.  The -n option only displays jobs that
2422              have stopped or exited  since  last  notified.   The  -p  option
2423              causes  only  the  process  group  to be listed.  See Jobs for a
2424              description of the format of job.
2425
2426       kill [ -s signame ] job ...
2427       kill [ -n signum ] job ...
2428       kill -Ll [ sig ... ]
2429              Sends either the TERM (terminate) signal or the specified signal
2430              to the specified jobs or processes.  Signals are either given by
2431              number with the -n option or by name  with  the  -s  option  (as
2432              given  in  <signal.h>,  stripped  of the prefix ``SIG'' with the
2433              exception that SIGCLD is named CHLD).  For backward  compatibil‐
2434              ity,  the  n  and s can be omitted and the number or name placed
2435              immediately after the -.  If the signal being sent is TERM (ter‐
2436              minate)  or HUP (hangup), then the job or process will be sent a
2437              CONT (continue) signal if it is stopped.  The argument  job  can
2438              be  the  process  id of a process that is not a member of one of
2439              the active jobs.  See Jobs for a description of  the  format  of
2440              job.   In  the  third  form,  kill -l, or kill -L, if sig is not
2441              specified, the signal names are listed.  The -l option list only
2442              the  signal names.  -L options lists each signal name and corre‐
2443              sponding number.  Otherwise, for each sig that is  a  name,  the
2444              corresponding  signal  number is listed.  For each sig that is a
2445              number, the signal name corresponding to the least significant 8
2446              bits of sig is listed.
2447
2448       let arg ...
2449              Each  arg  is  a separate arithmetic expression to be evaluated.
2450              let only recognizes octal constants starting with 0 when the set
2451              option  letoctal  is on.  See Arithmetic Evaluation above, for a
2452              description of arithmetic expression evaluation.
2453              The exit status is 0 if the value of the last expression is non-
2454              zero, and 1 otherwise.
2455
2456newgrp [ arg ... ]
2457              Equivalent to exec /bin/newgrp arg ....
2458
2459       print [ -CRenprsv ] [ -u unit] [ -f format ] [ arg ... ]
2460              With  no  options or with option - or --, each arg is printed on
2461              standard output.  The -f  option  causes  the  arguments  to  be
2462              printed  as  described  by printf.  In this case, any e, n, r, R
2463              options are ignored.  Otherwise, unless the -C, -R,  -r,  or  -v
2464              are specified, the following escape conventions will be applied:
2465              \a     The alert character (ascii 07).
2466              \b     The backspace character (ascii 010).
2467              \c     Causes print to end without processing more arguments and
2468                     not adding a new-line.
2469              \f     The formfeed character (ascii 014).
2470              \n     The new-line character (ascii 012).
2471              \r     The carriage return character (ascii 015).
2472              \t     The tab character (ascii 011).
2473              \v     The vertical tab character (ascii 013).
2474              \E     The escape character (ascii 033).
2475              \\     The backslash character \.
2476              \0x    The character defined by  the  1,  2,  or  3-digit  octal
2477                     string given by x.
2478
2479              The  -R  option  will print all subsequent arguments and options
2480              other than -n.  The -e causes the above escape conventions to be
2481              applied.   This is the default behavior.  It reverses the effect
2482              of an earlier -r.  The -p option  causes  the  arguments  to  be
2483              written  onto the pipe of the process spawned with ⎪& instead of
2484              standard output.  The -v option treats each arg  as  a  variable
2485              name  and  writes  the  value  in  the printf %B format.  The -C
2486              option treats each arg as a variable name and writes  the  value
2487              in the printf %#B format.  The -s option causes the arguments to
2488              be written onto the history file  instead  of  standard  output.
2489              The -u option can be used to specify a one digit file descriptor
2490              unit number unit on  which  the  output  will  be  placed.   The
2491              default is 1.  If the option -n is used, no new-line is added to
2492              the output.
2493
2494       printf format [ arg ... ]
2495              The arguments arg are printed on standard output  in  accordance
2496              with  the  ANSI-C  formatting  rules  associated with the format
2497              string format.  If the number of arguments exceeds the number of
2498              format  specifications,  the  format  string is reused to format
2499              remaining arguments.  The following extensions can also be used:
2500              %b     A %b format can be used instead of  %s  to  cause  escape
2501                     sequences  in  the  corresponding  arg  to be expanded as
2502                     described in print.
2503              %B     A %B option causes each of the arguments to be treated as
2504                     variable  names  and the binary value of variable will be
2505                     printed.  The alternate flag # causes a compound variable
2506                     to  be  output on a single line.  This is most useful for
2507                     compound variables and variables whose attribute is -b.
2508              %H     A %H format can be used instead of %s to cause characters
2509                     in  arg  that are special in HTML and XML to be output as
2510                     their entity name.  The alternate flag # formats the out‐
2511                     put for use as a URI.
2512              %P     A  %P format can be used instead of %s to cause arg to be
2513                     interpreted as an  extended  regular  expression  and  be
2514                     printed as a shell pattern.
2515              %R     A  %R format can be used instead of %s to cause arg to be
2516                     interpreted as a shell pattern and to be  printed  as  an
2517                     extended regular expression.
2518              %q     A  %q  format  can  be  used  instead  of %s to cause the
2519                     resulting string to be quoted in a  manner  than  can  be
2520                     reinput to the shell.  When q is preceded by the alterna‐
2521                     tive format specifier, #, the string is quoted in  manner
2522                     suitable as a field in a .csv format file.
2523              %(date-format)T
2524                     A  %(date-format)T format can be use to treat an argument
2525                     as a date/time string and to format the date/time accord‐
2526                     ing  to  the  date-format as defined for the date(1) com‐
2527                     mand.
2528              %Z     A %Z format will output a byte whose value is 0.
2529              %d     The precision field of the %d format can be followed by a
2530                     .  and the output base.  In this case, the # flag charac‐
2531                     ter causes base# to be prepended.
2532              #      The # flag, when used with the %d format without an  out‐
2533                     put base, displays the output in powers of 1000 indicated
2534                     by one of the following suffixes: k M G T P E,  and  when
2535                     used  with the %i format displays the output in powers of
2536                     1024 indicated by one of the following suffixes: Ki Mi Gi
2537                     Ti Pi Ei.
2538              =      The  = flag centers the output within the specified field
2539                     width.
2540              L      The L flag, when used with the %c or %s  formats,  treats
2541                     precision as character width instead of byte count.
2542              ,      The  ,  flag,  when used with the %d or %f formats, sepa‐
2543                     rates groups of digits with the grouping delimiter (,  on
2544                     groups of 3 in the C locale.)
2545
2546       pwd [ -LP ]
2547              Outputs  the  value  of  the  current working directory.  The -L
2548              option is the default; it prints the logical name of the current
2549              directory.   If  the  -P option is given, all symbolic links are
2550              resolved from the name.  The last instance of -L or  -P  on  the
2551              command line determines which method is used.
2552
2553       read  [  -ACSprsv  ] [ -d delim] [ -n n] [ [ -N n] [ [ -t timeout] [ -u
2554       unit] [ vname?prompt ] [ vname ... ]
2555              The shell input mechanism.  One line is read and  is  broken  up
2556              into  fields  using  the  characters  in IFS as separators.  The
2557              escape character, \, is used to remove any special  meaning  for
2558              the  next  character  and  for line continuation.  The -d option
2559              causes the read to continue to  the  first  character  of  delim
2560              rather  than  new-line.  The -n option causes at most n bytes to
2561              read rather a full line but will return when reading from a slow
2562              device  as soon as any characters have been read.  The -N option
2563              causes exactly n to be  read  unless  an  end-of-file  has  been
2564              encountered  or the read times out because of the -t option.  In
2565              raw mode, -r, the \ character is  not  treated  specially.   The
2566              first  field is assigned to the first vname, the second field to
2567              the second vname, etc., with leftover  fields  assigned  to  the
2568              last vname.  When vname has the binary attribute and -n or -N is
2569              specified, the bytes that are read are stored directly into  the
2570              variable.   If  the -v is specified, then the value of the first
2571              vname will be used as a default value when reading from a termi‐
2572              nal device.  The -A option causes the variable vname to be unset
2573              and each field that is read to be stored in successive  elements
2574              of  the  indexed array vname.  The -C option causes the variable
2575              vname to be read as a compound variable.  Blanks will be ignored
2576              when  finding  the  beginning  open  parenthesis.  The -S option
2577              causes the line to be treated like a record  in  a  .csv  format
2578              file  so  that  double quotes can be used to allow the delimiter
2579              character and the new-line character to appear within  a  field.
2580              The  -p  option causes the input line to be taken from the input
2581              pipe of a process spawned by the shell  using  ⎪&.   If  the  -s
2582              option  is  present, the input will be saved as a command in the
2583              history file.  The option -u can be used to specify a one  digit
2584              file descriptor unit unit to read from.  The file descriptor can
2585              be opened with the exec special built-in command.   The  default
2586              value  of unit n is 0.  The option -t is used to specify a time‐
2587              out in seconds when reading from a terminal or pipe.   If  vname
2588              is omitted, then REPLY is used as the default vname.  An end-of-
2589              file with the -p option causes cleanup for this process so  that
2590              another can be spawned.  If the first argument contains a ?, the
2591              remainder of this word is used as a  prompt  on  standard  error
2592              when  the  shell is interactive.  The exit status is 0 unless an
2593              end-of-file is encountered or read has timed out.
2594
2595       †† readonly [ -p ] [ vname[=value] ] ...
2596              If vname is not given, the names and  values  of  each  variable
2597              with the readonly attribute is printed with the values quoted in
2598              a manner that allows them to  be  re-inputted.   The  -p  option
2599              causes the word readonly to be inserted before each one.  Other‐
2600              wise, the given vnames are marked readonly and these names  can‐
2601              not  be changed by subsequent assignment.  When defining a type,
2602              if the value of a readonly sub-variable is not defined the value
2603              is required when creating each instance.
2604
2605return [ n ]
2606              Causes  a  shell function or .  script to return to the invoking
2607              script with the exit status specified by n.  The value  will  be
2608              the  least  significant 8 bits of the specified status.  If n is
2609              omitted, then the return status is that of the last command exe‐
2610              cuted.   If  return  is  invoked  while not in a function or a .
2611              script, then it behaves the same as exit.
2612
2613set [ ±BCGabefhkmnoprstuvx ] [ ±o [ option ] ] ... [ ±A  vname  ]   [
2614       arg ... ]
2615              The options for this command have meaning as follows:
2616              -A      Array  assignment.   Unset the variable vname and assign
2617                      values sequentially from the arg list.  If +A  is  used,
2618                      the variable vname is not unset first.
2619              -B      Enable  brace  pattern  field  generation.   This is the
2620                      default behavior.
2621              -B      Enable brace group expansion.  On by default.
2622              -C      Prevents redirection > from truncating  existing  files.
2623                      Files  that are created are opened with the O_EXCL mode.
2624                      Requires >⎪ to truncate a file when turned on.
2625              -G      Causes the pattern ∗∗ by itself to match files and  zero
2626                      or  more  directories  and sub-directories when used for
2627                      file name generation.  If followed by a / only  directo‐
2628                      ries and sub-directories are matched.
2629              -a      All  subsequent variables that are defined are automati‐
2630                      cally exported.
2631              -b      Prints job completion messages as soon as  a  background
2632                      job  changes  state  rather  than  waiting  for the next
2633                      prompt.
2634              -e      Unless contained in a ⎪⎪ or && command, or  the  command
2635                      following  an  if while or until command or in the pipe‐
2636                      line following !, if a command has a non-zero exit  sta‐
2637                      tus,  execute the ERR trap, if set, and exit.  This mode
2638                      is disabled while reading profiles.
2639              -f      Disables file name generation.
2640              -h      Each command becomes a tracked alias when first  encoun‐
2641                      tered.
2642              -k      (Obsolete). All variable assignment arguments are placed
2643                      in the environment for a command, not  just  those  that
2644                      precede the command name.
2645              -m      Background jobs will run in a separate process group and
2646                      a line will print upon completion.  The exit  status  of
2647                      background jobs is reported in a completion message.  On
2648                      systems with job control, this option is turned on auto‐
2649                      matically for interactive shells.
2650              -n      Read  commands  and check them for syntax errors, but do
2651                      not execute them.  Ignored for interactive shells.
2652              -o      The following argument  can  be  one  of  the  following
2653                      option names:
2654                      allexport
2655                              Same as -a.
2656                      errexit Same as -e.
2657                      bgnice  All background jobs are run at a lower priority.
2658                              This is the default mode.
2659                      braceexpand
2660                              Same as -B.
2661                      emacs   Puts you in an emacs style  in-line  editor  for
2662                              command entry.
2663                      globstar
2664                              Same as -G.
2665                      gmacs   Puts  you  in  a  gmacs style in-line editor for
2666                              command entry.
2667                      ignoreeof
2668                              The shell will not  exit  on  end-of-file.   The
2669                              command exit must be used.
2670                      keyword Same as -k.
2671                      letoctal
2672                              The  let command allows octal constants starting
2673                              with 0.
2674                      markdirs
2675                              All directory names  resulting  from  file  name
2676                              generation have a trailing / appended.
2677                      monitor Same as -m.
2678                      multiline
2679                              The  built-in editors will use multiple lines on
2680                              the screen for lines that are  longer  than  the
2681                              width  of the screen.  This may not work for all
2682                              terminals.
2683                      noclobber
2684                              Same as -C.
2685                      noexec  Same as -n.
2686                      noglob  Same as -f.
2687                      nolog   Do not save function definitions in the  history
2688                              file.
2689                      notify  Same as -b.
2690                      nounset Same as -u.
2691                      pipefail
2692                              A  pipeline  will  not complete until all compo‐
2693                              nents of the pipeline have  completed,  and  the
2694                              return  value will be the value of the last non-
2695                              zero command to fail or zero if no  command  has
2696                              failed.
2697                      showme  When  enabled, simple commands or pipelines pre‐
2698                              ceded by a semicolon (;) will be displayed as if
2699                              the  xtrace  option were enabled but will not be
2700                              executed.  Otherwise,  the  leading  ;  will  be
2701                              ignored.
2702                      privileged
2703                              Same as -p.
2704                      verbose Same as -v.
2705                      trackall
2706                              Same as -h.
2707                      vi      Puts  you  in  insert mode of a vi style in-line
2708                              editor until you hit the escape  character  033.
2709                              This  puts  you in control mode.  A return sends
2710                              the line.
2711                      viraw   Each character is processed as it is typed in vi
2712                              mode.
2713                      xtrace  Same as -x.
2714                      If  no  option name is supplied, then the current option
2715                      settings are printed.
2716              -p      Disables processing of the $HOME/.profile file and  uses
2717                      the  file  /etc/suid_profile  instead  of  the ENV file.
2718                      This mode is on whenever the effective uid (gid) is  not
2719                      equal  to  the  real uid (gid).  Turning this off causes
2720                      the effective uid and gid to be set to the real uid  and
2721                      gid.
2722              -r      Enables  the  restricted  shell.   This option cannot be
2723                      unset once set.
2724              -s      Sort the positional parameters lexicographically.
2725              -t      (Obsolete).  Exit after reading and executing  one  com‐
2726                      mand.
2727              -u      Treat unset parameters as an error when substituting.
2728              -v      Print shell input lines as they are read.
2729              -x      Print commands and their arguments as they are executed.
2730              --      Do  not  change any of the options; useful in setting $1
2731                      to a value beginning with -.   If  no  arguments  follow
2732                      this option then the positional parameters are unset.
2733
2734              As an obsolete feature, if the first arg is - then the -x and -v
2735              options are turned off and the next arg is treated as the  first
2736              argument.   Using  +  rather  than  - causes these options to be
2737              turned off.  These options can also be used upon  invocation  of
2738              the  shell.   The  current  set  of  options may be found in $-.
2739              Unless -A is specified, the remaining arguments  are  positional
2740              parameters  and  are  assigned,  in  order, to $1 $2 ....  If no
2741              arguments are given, then the names and values of all  variables
2742              are printed on the standard output.
2743
2744shift [ n ]
2745              The  positional  parameters  from $n+1 ...  are renamed $1 ... ,
2746              default n is 1.  The parameter n can be any  arithmetic  expres‐
2747              sion  that evaluates to a non-negative number less than or equal
2748              to $#.
2749
2750       sleep seconds
2751              Suspends execution for the number of decimal  seconds  or  frac‐
2752              tions of a second given by seconds.
2753
2754trap [ -p ] [ action ] [ sig ] ...
2755              The  -p  option causes the trap action associated with each trap
2756              as specified by the arguments to  be  printed  with  appropriate
2757              quoting.   Otherwise,  action will be processed as if it were an
2758              argument to eval when the shell receives  signal(s)  sig.   Each
2759              sig can be given as a number or as the name of the signal.  Trap
2760              commands are executed in order of signal number.  Any attempt to
2761              set  a trap on a signal that was ignored on entry to the current
2762              shell is ineffective.  If action is omitted and the first sig is
2763              a  number,  or if action is -, then the trap(s) for each sig are
2764              reset to their original values.  If action is  the  null  string
2765              then  this signal is ignored by the shell and by the commands it
2766              invokes.  If sig is ERR then action will be executed whenever  a
2767              command has a non-zero exit status.  If sig is DEBUG then action
2768              will be executed before each command.  The variable  .sh.command
2769              will  contain  the  contents  of  the  current command line when
2770              action is running.  If the exit status of the trap is 2 the com‐
2771              mand  will  not  be executed.  If the exit status of the trap is
2772              255 and inside a function or a dot script, the function  or  dot
2773              script  will return.  If sig is 0 or EXIT and the trap statement
2774              is executed inside the body of a function defined with the func‐
2775              tion  name syntax, then the command action is executed after the
2776              function completes.  If sig is 0 or EXIT for a trap set  outside
2777              any  function  then  the command action is executed on exit from
2778              the shell.  If sig is KEYBD, then action will be executed  when‐
2779              ever  a key is read while in emacs, gmacs, or vi mode.  The trap
2780              command with no arguments prints a list of  commands  associated
2781              with each signal number.
2782
2783       An  exit  or  return without an argument in a trap action will preserve
2784       the exit status of the command that invoked the trap.
2785
2786       true   Does nothing, and exits 0. Used with while for infinite loops.
2787
2788       †† typeset [ ±ACHSfblmnprtux ] [ ±EFLRXZi[n] ]   [ +-M  [ mapname ] ] [
2789       -T  [ tname=(assign_list) ] ] [ -h str ] [ -a [type] ] [ vname[=value ]
2790        ] ...
2791              Sets attributes and values for shell  variables  and  functions.
2792              When  invoked  inside  a function defined with the function name
2793              syntax, a new instance of the variable vname is created, and the
2794              variable's  value  and  type are restored when the function com‐
2795              pletes.  The following list of attributes may be specified:
2796              -A     Declares vname to be an  associative  array.   Subscripts
2797                     are strings rather than arithmetic expressions.
2798              -C     causes each vname to be a compound variable.  value names
2799                     a compound variable it is copied into vname.   Otherwise,
2800                     it unsets each vname.
2801              -a     Declares vname to be an indexed array.  If type is speci‐
2802                     fied, it must be the name of an enumeration type  created
2803                     with the enum command and it allows enumeration constants
2804                     to be used as subscripts.
2805              -E     Declares vname to be a double  precision  floating  point
2806                     number.   If n is non-zero, it defines the number of sig‐
2807                     nificant figures that  are  used  when  expanding  vname.
2808                     Otherwise, ten significant figures will be used.
2809              -F     Declares  vname  to  be a double precision floating point
2810                     number.  If n is  non-zero,  it  defines  the  number  of
2811                     places after the decimal point that are used when expand‐
2812                     ing vname.  Otherwise ten places after the decimal  point
2813                     will be used.
2814              -H     This  option  provides  UNIX to host-name file mapping on
2815                     non-UNIX machines.
2816              -L     Left justify and remove leading blanks from value.  If  n
2817                     is non-zero, it defines the width of the field, otherwise
2818                     it is determined by the  width  of  the  value  of  first
2819                     assignment.   When  the  variable  is  assigned to, it is
2820                     filled on the right with blanks or truncated,  if  neces‐
2821                     sary,  to  fit  into  the field.  The -R option is turned
2822                     off.
2823              -M     Use the character mapping mapping defined by  wctrans(3).
2824                     such  as  tolower  and  toupper when assigning a value to
2825                     each of the specified operands.  When mapping  is  speci‐
2826                     fied  and  there are not operands, all variables that use
2827                     this mapping are written to standard output.   When  map‐
2828                     ping  is  omitted  and  there are no operands, all mapped
2829                     variables are written to standard output.
2830              -R     Right justify and fill with leading blanks.  If n is non-
2831                     zero,  it defines the width of the field, otherwise it is
2832                     determined by the width of the value of first assignment.
2833                     The  field  is  left filled with blanks or truncated from
2834                     the end if the variable is reassigned.  The -L option  is
2835                     turned off.
2836              -S     When used within the assign_list of a type definition, it
2837                     causes the specified sub-variable to  be  shared  by  all
2838                     instances  of  the  type.   When  used  inside a function
2839                     defined with the function reserved  word,  the  specified
2840                     variables  will  have  function static scope.  Otherwise,
2841                     the variable is unset prior to processing the  assignment
2842                     list.
2843              -T     If  followed  by  tname, it creates a type named by tname
2844                     using the compound assignment assign_list to tname.  Oth‐
2845                     erwise,  it  writes  all the type definitions to standard
2846                     output.
2847              -X     Declares vname to be a double  precision  floating  point
2848                     number  and expands using the %a format of ISO-C99.  If n
2849                     is non-zero, it defines the number of  hex  digits  after
2850                     the  radix  point that is used when expanding vname.  The
2851                     default is 10.
2852              -Z     Right justify and fill with leading zeros  if  the  first
2853                     non-blank  character is a digit and the -L option has not
2854                     been set.  Remove leading zeros if the -L option is  also
2855                     set.   If  n  is  non-zero,  it  defines the width of the
2856                     field, otherwise it is determined by  the  width  of  the
2857                     value of first assignment.
2858              -f     The  names  refer  to function names rather than variable
2859                     names.  No assignments can be made  and  the  only  other
2860                     valid  options are -S, -t, -u and -x.  The -S can be used
2861                     with discipline functions defined in a type  to  indicate
2862                     that  the function is static.  For a static function, the
2863                     same method will be used by all instances of that type no
2864                     matter which instance references it.  In addition, it can
2865                     only use value of variables from the original type  defi‐
2866                     nition.   These  discipline functions cannot be redefined
2867                     in any type instance.  The -t option turns  on  execution
2868                     tracing  for  this  function.   The -u option causes this
2869                     function to be marked undefined.  The FPATH variable will
2870                     be  searched  to  find  the  function definition when the
2871                     function is referenced.  If no options other than  -f  is
2872                     specified, then the function definition will be displayed
2873                     on standard output.  If +f is specified, then a line con‐
2874                     taining  the  function  name  followed by a shell comment
2875                     containing the line number and  path  name  of  the  file
2876                     where  this  function  was defined, if any, is displayed.
2877                     The exit status can be  used  to  determine  whether  the
2878                     function is defined so that typeset -f .sh.math.name will
2879                     return 0 when math function name is defined and  non-zero
2880                     otherwise.
2881              -b     The  variable  can hold any number of bytes of data.  The
2882                     data can be text or binary.  The value is represented  by
2883                     the  base64  encoding  of the data.  If -Z is also speci‐
2884                     fied, the size in bytes of the data in the buffer will be
2885                     determined  by  the  size associated with the -Z.  If the
2886                     base64 string assigned results in more data, it  will  be
2887                     truncated.  Otherwise, it will be filled with bytes whose
2888                     value is zero.  The printf format %B can be used to  out‐
2889                     put  the actual data in this buffer instead of the base64
2890                     encoding of the data.
2891              -h     Used within type definitions to add information when gen‐
2892                     erating  information  about  the  sub-variable on the man
2893                     page.  It is ignored when used outside of a type  defini‐
2894                     tion.   When  used  with -f the information is associated
2895                     with the corresponding discipline function.
2896              -i     Declares vname to be represented internally  as  integer.
2897                     The  right  hand side of an assignment is evaluated as an
2898                     arithmetic expression when assigning to an integer.  If n
2899                     is  non-zero, it defines the output arithmetic base, oth‐
2900                     erwise the output base will be ten.
2901              -l     Used with -i, -E or -F, to indicate long integer, or long
2902                     float.   Otherwise,  all  upper-case  characters are con‐
2903                     verted to lower-case.   The  upper-case  option,  -u,  is
2904                     turned off.  Equivalent to -M tolower .
2905              -m     moves  or renames the variable.  The value is the name of
2906                     a variable whose value will be moved to vname.  The orig‐
2907                     inal  variable  will  be  unset.  Cannot be used with any
2908                     other options.
2909              -n     Declares vname to be a reference to  the  variable  whose
2910                     name  is defined by the value of variable vname.  This is
2911                     usually used to reference a variable  inside  a  function
2912                     whose  name  has  been  passed as an argument.  Cannot be
2913                     used with any other options.
2914              -p     The name, attributes and values for the given vnames  are
2915                     written  on standard output in a form that can be used as
2916                     shell input.  If +p is specified, then the values are not
2917                     displayed.
2918              -r     The given vnames are marked readonly and these names can‐
2919                     not be changed by subsequent assignment.
2920              -t     Tags the variables.  Tags are user definable and have  no
2921                     special meaning to the shell.
2922              -u     When  given  along  with  -i, specifies unsigned integer.
2923                     Otherwise, all lower-case  characters  are  converted  to
2924                     upper-case.   The  lower-case  option, -l, is turned off.
2925                     Equivalent to -M toupper .
2926              -x     The given vnames are marked for automatic export  to  the
2927                     environment of subsequently-executed commands.  Variables
2928                     whose names contain a .  cannot be exported.
2929
2930              The -i attribute cannot be specified along with -R, -L,  -Z,  or
2931              -f.
2932
2933              Using + rather than - causes these options to be turned off.  If
2934              no vname arguments are given, a list of vnames  (and  optionally
2935              the values) of the variables is printed.  (Using + rather than -
2936              keeps the values from being  printed.)   The  -p  option  causes
2937              typeset followed by the option letters to be printed before each
2938              name rather than the names of the options.  If any option  other
2939              than  -p  is  given,  only those variables which have all of the
2940              given options are printed.  Otherwise, the vnames and attributes
2941              of all variables that have attributes are printed.
2942
2943       ulimit [ -HSacdfmnpstv ] [ limit ]
2944              Set  or display a resource limit.  The available resource limits
2945              are listed below.  Many systems do not support one  or  more  of
2946              these  limits.   The  limit for a specified resource is set when
2947              limit is specified.  The value of limit can be a number  in  the
2948              unit specified below with each resource, or the value unlimited.
2949              The -H and -S options specify whether the hard limit or the soft
2950              limit  for  the  given  resource is set.  A hard limit cannot be
2951              increased once it is set.  A soft limit can be increased  up  to
2952              the  value  of the hard limit.  If neither the H nor S option is
2953              specified, the limit applies  to  both.   The  current  resource
2954              limit  is printed when limit is omitted.  In this case, the soft
2955              limit is printed unless H is  specified.   When  more  than  one
2956              resource  is  specified, then the limit name and unit is printed
2957              before the value.
2958              -a     Lists all of the current resource limits.
2959              -c     The number of 512-byte blocks on the size of core dumps.
2960              -d     The number of K-bytes on the size of the data area.
2961              -f     The number of 512-byte blocks on files that can be  writ‐
2962                     ten  by  the current process or by child processes (files
2963                     of any size may be read).
2964              -m     The number of K-bytes on the size of physical memory.
2965              -n     The number of file descriptors plus 1.
2966              -p     The number of 512-byte blocks for pipe buffering.
2967              -s     The number of K-bytes on the size of the stack area.
2968              -t     The number of CPU seconds to be used by each process.
2969              -v     The number of K-bytes for virtual memory.
2970
2971              If no option is given, -f is assumed.
2972
2973       umask [ -S ] [ mask ]
2974              The user file-creation mask is set to mask (see umask(2)).  mask
2975              can  either  be an octal number or a symbolic value as described
2976              in chmod(1).  If a symbolic value is given, the new umask  value
2977              is  the complement of the result of applying mask to the comple‐
2978              ment of the previous umask value.  If mask is omitted, the  cur‐
2979              rent  value  of  the  mask is printed.  The -S option causes the
2980              mode to be printed as a symbolic value.  Otherwise, the mask  is
2981              printed in octal.
2982
2983unalias [ -a ] name ...
2984              The  aliases  given  by  the  list of names are removed from the
2985              alias list.  The -a option causes all the aliases to be unset.
2986
2987unset [ -fnv ] vname ...
2988              The variables given by the list of vnames are unassigned,  i.e.,
2989              except  for  sub-variables  within  a  type,  their  values  and
2990              attributes are erased.  For sub-variables of a type, the  values
2991              are  reset to the default value from the type definition.  Read‐
2992              only variables cannot be unset.  If the -f option is  set,  then
2993              the  names  refer  to  function names.  If the -v option is set,
2994              then the names refer to variable names.  The -f option overrides
2995              -v.   If  -n is set and name is a name reference, then name will
2996              be unset rather than  the  variable  that  it  references.   The
2997              default  is  equivalent  to  -v.   Unsetting  LINENO, MAILCHECK,
2998              OPTARG, OPTIND, RANDOM, SECONDS, TMOUT, and _ removes their spe‐
2999              cial meaning even if they are subsequently assigned to.
3000
3001       wait [ job ... ]
3002              Wait  for  the  specified job and report its termination status.
3003              If job is not given, then all currently active  child  processes
3004              are  waited  for.   The exit status from this command is that of
3005              the last process waited for if job is specified; otherwise it is
3006              zero.  See Jobs for a description of the format of job.
3007
3008       whence [ -afpv ] name ...
3009              For each name, indicate how it would be interpreted if used as a
3010              command name.
3011              The -v option produces a more verbose  report.   The  -f  option
3012              skips  the  search  for  functions.   The  -p option does a path
3013              search for name even if name is  an  alias,  a  function,  or  a
3014              reserved  word.   The -p option turns off the -v option.  The -a
3015              option is similar to the -v option but  causes  all  interpreta‐
3016              tions of the given name to be reported.
3017
3018   Invocation.
3019       If the shell is invoked by exec(2), and the first character of argument
3020       zero ($0) is -, then the shell is assumed to be a login shell and  com‐
3021       mands  are  read from /etc/profile and then from either .profile in the
3022       current directory or $HOME/.profile, if either file exists.  Next,  for
3023       interactive shells, commands are read from the file named by performing
3024       parameter expansion, command substitution, and arithmetic  substitution
3025       on  the  value  of the environment variable ENV if the file exists.  If
3026       the -s option is not present and arg and a file  by  the  name  of  arg
3027       exists,  then  it  reads  and  executes this script.  Otherwise, if the
3028       first arg does not contain a /, a path search is performed on the first
3029       arg  to  determine  the  name of the script to execute.  The script arg
3030       must have execute permission and any setuid and setgid settings will be
3031       ignored.   If  the script is not found on the path, arg is processed as
3032       if it named a built-in command or function.  Commands are then read  as
3033       described  below;  the  following  options are interpreted by the shell
3034       when it is invoked:
3035
3036       -D      Do not execute the script, but output the set of double  quoted
3037               strings  preceded  by a $.  These strings are needed for local‐
3038               ization of the script to different locales.
3039       -E      Reads the file named by the ENV variable or by $HOME/.kshrc  if
3040               not defined after the profiles.
3041       -c        If  the -c option is present, then commands are read from the
3042                 first arg.  Any remaining arguments become positional parame‐
3043                 ters starting at 0.
3044       -s        If  the  -s option is present or if no arguments remain, then
3045                 commands are read from the  standard  input.   Shell  output,
3046                 except  for  the output of the Special Commands listed above,
3047                 is written to file descriptor 2.
3048       -i        If the -i option is present or if the shell input  and  error
3049                 output  are attached to a terminal (as told by tcgetattr(2)),
3050                 then this shell is interactive.  In this case TERM is ignored
3051                 (so  that kill 0 does not kill an interactive shell) and INTR
3052                 is caught and ignored (so that wait is ).  In all cases, QUIT
3053                 is ignored by the shell.
3054       -r        If the -r option is present, the shell is a restricted shell.
3055       -D        A  list of all double quoted strings that are preceded by a $
3056                 will be printed on standard output and the shell  will  exit.
3057                 This  set  of strings will be subject to language translation
3058                 when the locale is not C or POSIX.  No commands will be  exe‐
3059                 cuted.
3060
3061       -P        If  -P or -o profile is present, the shell is a profile shell
3062                 (see pfexec(1)).
3063
3064       -R filename
3065                 The -R filename option is used to generate a cross  reference
3066                 database that can be used by a separate utility to find defi‐
3067                 nitions and references for variables and commands.  The file‐
3068                 name argument specifies the generated database. A script file
3069                 must be provided on the command line as well.
3070
3071       The remaining options and arguments are described under the set command
3072       above.  An optional - as the first argument is ignored.
3073
3074   Rksh Only.
3075       Rksh  is  used  to  set up login names and execution environments whose
3076       capabilities are more controlled than those of the standard shell.  The
3077       actions  of rksh are identical to those of ksh, except that the follow‐
3078       ing are disallowed:
3079              Unsetting the restricted option.
3080              changing directory (see cd(1)),
3081              setting or unsetting the value  or  attributes  of  SHELL,  ENV,
3082              FPATH, or PATH,
3083              specifying path or command names containing /,
3084              redirecting output (>, >|, <>, and >>).
3085              adding or deleting built-in commands.
3086              using command -p to invoke a command.
3087
3088       The  restrictions  above  are enforced after .profile and the ENV files
3089       are interpreted.
3090
3091       When a command to be executed is found to be a  shell  procedure,  rksh
3092       invokes ksh to execute it.  Thus, it is possible to provide to the end-
3093       user shell procedures that have access to the full power of  the  stan‐
3094       dard  shell,  while  imposing  a  limited menu of commands; this scheme
3095       assumes that the end-user does not have write and  execute  permissions
3096       in the same directory.
3097
3098       The  net  effect  of these rules is that the writer of the .profile has
3099       complete control over user  actions,  by  performing  guaranteed  setup
3100       actions  and leaving the user in an appropriate directory (probably not
3101       the login directory).
3102
3103       The system administrator often sets up a directory of  commands  (e.g.,
3104       /usr/rbin) that can be safely invoked by rksh.
3105

EXIT STATUS

3107       Errors detected by the shell, such as syntax errors, cause the shell to
3108       return a non-zero exit status.  If the shell is being used non-interac‐
3109       tively,  then execution of the shell file is abandoned unless the error
3110       occurs inside a subshell in which case the subshell is abandoned.  Oth‐
3111       erwise,  the shell returns the exit status of the last command executed
3112       (see also the exit command above).  Run time  errors  detected  by  the
3113       shell  are  reported  by  printing the command or function name and the
3114       error condition.  If the line number that  the  error  occurred  on  is
3115       greater than one, then the line number is also printed in square brack‐
3116       ets ([]) after the command or function name.
3117

FILES

3119       /etc/profile
3120              The system wide initialization file, executed for login shells.
3121
3122       $HOME/.profile
3123              The personal initialization  file,  executed  for  login  shells
3124              after /etc/profile.
3125
3126       $HOME/..kshrc
3127              Default  personal  initialization file, executed for interactive
3128              shells when ENV is not set.
3129
3130       /etc/suid_profile
3131              Alternative initialization file, executed instead  of  the  per‐
3132              sonal  initialization  file  when the real and effective user or
3133              group id do not match.
3134
3135       /dev/null
3136              NULL device
3137

SEE ALSO

3139       cat(1), cd(1), chmod(1), cut(1), egrep(1), echo(1),  emacs(1),  env(1),
3140       fgrep(1),  gmacs(1),  grep(1),  newgrp(1), pfexec(1), stty(1), test(1),
3141       umask(1),  vi(1),  dup(2),  exec(2),  fork(2),  getpwnam(3),  ioctl(2),
3142       lseek(2),   paste(1),   pathconf(2),   pipe(2),  sysconf(2),  umask(2),
3143       ulimit(2), wait(2), wctrans(3), rand(3),  a.out(5),  profile(5),  envi‐
3144       ron(7).
3145
3146       Morris  I. Bolsky and David G. Korn, The New KornShell Command and Pro‐
3147       gramming Language, Prentice Hall, 1995.
3148
3149       POSIX - Part 2: Shell and  Utilities,  IEEE  Std  1003.2-1992,  ISO/IEC
3150       9945-2, IEEE, 1993.
3151

CAVEATS

3153       If  a  command  is  executed,  and then a command with the same name is
3154       installed in a directory in the search path before the directory  where
3155       the  original  command  was  found, the shell will continue to exec the
3156       original command.  Use the -t option of the alias  command  to  correct
3157       this situation.
3158
3159       Some very old shell scripts contain a ^ as a synonym for the pipe char‐
3160       acter .
3161
3162       Using the hist built-in command within a compound  command  will  cause
3163       the whole command to disappear from the history file.
3164
3165       The  built-in  command  . file reads the whole file before any commands
3166       are executed.  Therefore, alias and unalias commands in the  file  will
3167       not apply to any commands defined in the file.
3168
3169       Traps  are  not  processed  while  a  job  is  waiting for a foreground
3170       process.  Thus, a trap on CHLD won't be executed until  the  foreground
3171       job terminates.
3172
3173       It  is  a good idea to leave a space after the comma operator in arith‐
3174       metic expressions to prevent the comma from being  interpreted  as  the
3175       decimal point character in certain locales.
3176
3177
3178
3179                                                                        KSH(1)
Impressum