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

NAME

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

SYNOPSIS

10       ksh [ ±abcefhikmnoprstuvxBCDP ] [ -R file ] [ ±o option ] ... [ -  ]  [
11       arg ... ]
12       rksh  [ ±abcefhikmnoprstuvxBCD ] [ -R file ] [ ±o option ] ...  [ - ] [
13       arg ... ]
14

DESCRIPTION

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

EXIT STATUS

3062       Errors detected by the shell, such as syntax errors, cause the shell to
3063       return a non-zero exit status.  If the shell is being used non-interac‐
3064       tively,  then execution of the shell file is abandoned unless the error
3065       occurs inside a subshell in which case the subshell is abandoned.  Oth‐
3066       erwise,  the shell returns the exit status of the last command executed
3067       (see also the exit command above).  Run time  errors  detected  by  the
3068       shell  are  reported  by  printing the command or function name and the
3069       error condition.  If the line number that  the  error  occurred  on  is
3070       greater than one, then the line number is also printed in square brack‐
3071       ets ([]) after the command or function name.
3072

FILES

3074       /etc/profile
3075              The system wide initialization file, executed for login shells.
3076
3077       $HOME/.profile
3078              The personal initialization  file,  executed  for  login  shells
3079              after /etc/profile.
3080
3081       $HOME/..kshrc
3082              Default  personal  initialization file, executed for interactive
3083              shells when ENV is not set.
3084
3085       /etc/suid_profile
3086              Alternative initialization file, executed instead  of  the  per‐
3087              sonal  initialization  file  when the real and effective user or
3088              group id do not match.
3089
3090       /dev/null
3091              NULL device
3092

SEE ALSO

3094       cat(1), cd(1), chmod(1), cut(1), egrep(1), echo(1),  emacs(1),  env(1),
3095       fgrep(1),  gmacs(1),  grep(1),  newgrp(1), pfexec(1), stty(1), test(1),
3096       umask(1),  vi(1),  dup(2),  exec(2),  fork(2),  getpwnam(3),  ioctl(2),
3097       lseek(2),   paste(1),   pathconf(2),   pipe(2),  sysconf(2),  umask(2),
3098       ulimit(2), wait(2), wctrans(3), rand(3),  a.out(5),  profile(5),  envi‐
3099       ron(7).
3100
3101       Morris  I. Bolsky and David G. Korn, The New KornShell Command and Pro‐
3102       gramming Language, Prentice Hall, 1995.
3103
3104       POSIX - Part 2: Shell and  Utilities,  IEEE  Std  1003.2-1992,  ISO/IEC
3105       9945-2, IEEE, 1993.
3106

CAVEATS

3108       If  a  command  is  executed,  and then a command with the same name is
3109       installed in a directory in the search path before the directory  where
3110       the  original  command  was  found, the shell will continue to exec the
3111       original command.  Use the -t option of the alias  command  to  correct
3112       this situation.
3113
3114       Some very old shell scripts contain a ^ as a synonym for the pipe char‐
3115       acter .
3116
3117       Using the hist built-in command within a compound  command  will  cause
3118       the whole command to disappear from the history file.
3119
3120       The  built-in  command  . file reads the whole file before any commands
3121       are executed.  Therefore, alias and unalias commands in the  file  will
3122       not apply to any commands defined in the file.
3123
3124       Traps  are  not  processed  while  a  job  is  waiting for a foreground
3125       process.  Thus, a trap on CHLD won't be executed until  the  foreground
3126       job terminates.
3127
3128       It  is  a good idea to leave a space after the comma operator in arith‐
3129       metic expressions to prevent the comma from being  interpreted  as  the
3130       decimal point character in certain locales.
3131
3132
3133
3134RDS Standard              User Environment Utilities                    KSH(1)
Impressum