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

NOTE

10       Currently, rksh and pfksh are not available on macOS / Darwin.
11

SYNOPSIS

13       ksh [ ±abcefhiknoprstuvxBCDP ] [ -R file ] [ ±o option ] ... [  -  ]  [
14       arg ... ]
15

DESCRIPTION

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

EXIT STATUS

3262       Errors detected by the shell, such as syntax errors, cause the shell to
3263       return a non-zero exit status.  If the shell is being used non-interac‐
3264       tively,  then execution of the shell file is abandoned unless the error
3265       occurs inside a subshell in which case the subshell is abandoned.  Oth‐
3266       erwise,  the shell returns the exit status of the last command executed
3267       (see also the exit command above).  Run time  errors  detected  by  the
3268       shell  are  reported  by  printing the command or function name and the
3269       error condition.  If the line number that  the  error  occurred  on  is
3270       greater than one, then the line number is also printed in square brack‐
3271       ets ([]) after the command or function name.
3272

FILES

3274       /etc/profile
3275              The system wide initialization file, executed for login shells.
3276
3277       $HOME/.profile
3278              The personal initialization  file,  executed  for  login  shells
3279              after /etc/profile.
3280
3281       $HOME/.kshrc
3282              Default  personal  initialization file, executed for interactive
3283              shells when ENV is not set.
3284
3285       /etc/suid_profile
3286              Alternative initialization file, executed instead  of  the  per‐
3287              sonal  initialization  file  when the real and effective user or
3288              group id do not match.
3289
3290       /dev/null
3291              NULL device
3292

SEE ALSO

3294       cat(1), cd(1), chmod(1), cut(1), date(1), egrep(1), echo(1),  emacs(1),
3295       env(1),  fgrep(1),  gmacs(1),  grep(1),  newgrp(1), pfexec(1), stty(1),
3296       test(1), touch(1), umask(1), vi(1), dup(2),  exec(2),  fork(2),  getpw‐
3297       nam(3),  ioctl(2),  lseek(2),  paste(1),  pathconf(2), pipe(2), sigset‐
3298       info(2), sysconf(2), umask(2), ulimit(2), wait(2), wctrans(3), rand(3),
3299       a.out(5), profile(5), environ(7).
3300
3301       Morris  I. Bolsky and David G. Korn, The New KornShell Command and Pro‐
3302       gramming Language, Prentice Hall, 1995.
3303
3304       POSIX - Part 2: Shell and  Utilities,  IEEE  Std  1003.2-1992,  ISO/IEC
3305       9945-2, IEEE, 1993.
3306

CAVEATS

3308       If  a  command  is  executed,  and then a command with the same name is
3309       installed in a directory in the search path before the directory  where
3310       the  original  command  was  found, the shell will continue to exec the
3311       original command.  Use the -t option of the alias  command  to  correct
3312       this situation.
3313
3314       Some very old shell scripts contain a ^ as a synonym for the pipe char‐
3315       acter .
3316
3317       Using the hist built-in command within a compound  command  will  cause
3318       the whole command to disappear from the history file.
3319
3320       The  built-in  command  . file reads the whole file before any commands
3321       are executed.  Therefore, alias and unalias commands in the  file  will
3322       not apply to any commands defined in the file.
3323
3324       Traps  are  not  processed  while  a  job  is  waiting for a foreground
3325       process.  Thus, a trap on CHLD won't be executed until  the  foreground
3326       job terminates.
3327
3328       It  is  a good idea to leave a space after the comma operator in arith‐
3329       metic expressions to prevent the comma from being  interpreted  as  the
3330       decimal point character in certain locales.
3331
3332
3333
3334                                                                        KSH(1)
Impressum