Print this page
13405 ksh93 update to 2012-08-01: part 4: man page
Change-ID: If0d23a7414155253671c169228cb81ea13abbfc1

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man1/ksh93.1.man.txt
          +++ new/usr/src/man/man1/ksh93.1.man.txt
↓ open down ↓ 119 lines elided ↑ open up ↑
 120  120  
 121  121         for vname [ in word ... ] ;do list ;done
 122  122  
 123  123             Each time a for command is executed, vname is set to the next word
 124  124             taken from the in word list. If in word ... is omitted, the for
 125  125             command executes the do list once for each positional parameter
 126  126             that is set starting from 1. Execution ends when there are no more
 127  127             words in the list. See Parameter Expansion.
 128  128  
 129  129  
 130      -       (( [expr1] ; [expr2] ; [expr3] )) ;do list ;done
      130 +       for (( [expr1] ; [expr2] ; [expr3] )) ;do list ;done
 131  131  
 132  132             The arithmetic expression expr1 is evaluated first. The arithmetic
 133  133             expression expr2 is repeatedly evaluated until it evaluates to zero
 134  134             and when non-zero, list is executed and the arithmetic expression
 135  135             expr3 evaluated. If any expression is omitted, then it behaves as
 136  136             if it evaluated to 1. See Arithmetic Evaluation.
 137  137  
 138  138  
 139  139         select vname [ in word ... ] ;do list ;done
 140  140  
↓ open down ↓ 46 lines elided ↑ open up ↑
 187  187  
 188  188  
 189  189         ((expression))
 190  190  
 191  191             The expression is evaluated using the rules for arithmetic
 192  192             evaluation described in this manual page. If the value of the
 193  193             arithmetic expression is non-zero, the exit status is 0. Otherwise
 194  194             the exit status is 1.
 195  195  
 196  196  
 197      -       (list;)
      197 +       (list)
 198  198  
 199  199             Execute list in a separate environment. If two adjacent open
 200  200             parentheses are needed for nesting, a SPACE must be inserted to
 201  201             avoid evaluation as an arithmetic command as described in this
 202  202             section.
 203  203  
      204 +
      205 +       { list;}
      206 +
 204  207             list is simply executed. Unlike the metacharacters, ( and ), { and
 205  208             } are reserved words and must occur at the beginning of a line or
 206  209             after a ; to be recognized.
 207  210  
 208  211  
 209  212         [[ expression ]]
 210  213  
 211  214             Evaluates expression and returns a zero exit status when expression
 212  215             is true. See Conditional Expressions for a description of
 213  216             expression.
 214  217  
 215  218  
 216  219         function varname { list ;}
 217  220         varname () { list ;}
 218  221  
 219  222             Define a function which is referenced by varname. A function whose
 220      -           varname contains a . is called a discipline function and the
      223 +           varname contains a dot (.) is called a discipline function and the
 221  224             portion of the varname preceding the last . must refer to an
 222  225             existing variable.
 223  226  
 224  227             The body of the function is the list of commands between { and }. A
 225  228             function defined with the function varname syntax can also be used
 226  229             as an argument to the . special built-in command to get the
 227  230             equivalent behavior as if the varname() syntax were used to define
 228  231             it. See Functions.
 229  232  
 230  233  
      234 +       namespace identifier { list };
      235 +
      236 +           Defines or uses the name space identifier and runs the commands in
      237 +           list in this name space.  See Name Spaces.
      238 +
      239 +
 231  240         time [ pipeline ]
 232  241  
 233  242             If pipeline is omitted, the user and system time for the current
 234  243             shell and completed child processes is printed on standard error.
 235  244             Otherwise, pipeline is executed and the elapsed time as well as the
 236  245             user and system time are printed on standard error. The TIMEFORMAT
 237  246             variable can be set to a format string that specifies how the
 238  247             timing information should be displayed.  See Shell Variables for a
 239  248             description of the TIMEFORMAT variable.
 240  249  
 241  250  
 242  251  
 243  252         The following reserved words are recognized as reserved only when they
 244  253         are the first word of a command and are not quoted:
      254 +
 245  255           case
 246  256           do
 247  257           done
 248  258           else
 249  259           elif
 250  260           esac
 251  261           for
 252  262           fi
 253  263           function
 254  264           if
↓ open down ↓ 1 lines elided ↑ open up ↑
 256  266           then
 257  267           time
 258  268           until
 259  269           while
 260  270           { }
 261  271           [[ ]]
 262  272           !
 263  273  
 264  274     Variable Assignments
 265  275         One or more variable assignments can start a simple command or can be
 266      -       arguments to the typeset, export, or readonly special built-in
      276 +       arguments to the typeset, enum, export, or readonly special built-in
 267  277         commands. The syntax for an assignment is of the form:
 268  278  
 269  279         varname=word
 270  280         varname[word]=word
 271  281  
 272  282             No space is permitted between varname and the = or between = and
 273      -           word.
      283 +           word.  The variable varname is unset before the assignment.
 274  284  
 275  285  
 276  286         varname=(assignlist)
 277  287  
 278  288             No space is permitted between varname and the =. An assignlist can
 279  289             be one of the following:
 280  290  
 281  291             word ...
 282  292  
 283  293                 Indexed array assignment.
↓ open down ↓ 16 lines elided ↑ open up ↑
 300  310                 is a compound variable allowing subsequence child elements to
 301  311                 be defined.
 302  312  
 303  313  
 304  314             typeset [options] assignment ...
 305  315  
 306  316                 Nested variable assignment. Multiple assignments can be
 307  317                 specified by separating each of them with a ;. The previous
 308  318                 value is unset before the assignment.
 309  319  
      320 +
      321 +           . filename
      322 +
      323 +               Include the assignment commands contained in filename.
      324 +
 310  325             In addition, a += can be used in place of the = to signify adding
 311  326             to or appending to the previous value. When += is applied to an
 312  327             arithmetic type, word is evaluated as an arithmetic expression and
 313  328             added to the current value. When applied to a string variable, the
 314  329             value defined by word is appended to the value. For compound
 315  330             assignments, the previous value is not unset and the new values are
 316  331             appended to the current ones provided that the types are
 317  332             compatible.
 318  333  
      334 +           The right hand side of a variable assignment undergoes all the
      335 +           expansion listed below except word splitting, brace expansion, and
      336 +           file name generation.  When the left hand side is an assignment is
      337 +           a compound variable and the right hand is the name of a compound
      338 +           variable, the compound variable on the right will be copied or
      339 +           appended to the compound variable on the left.
 319  340  
      341 +
      342 +
 320  343     Comments
 321  344         A word beginning with # causes that word and all the following
 322  345         characters up to a NEWLINE to be commented, or ignored.
 323  346  
 324  347     Aliasing
 325  348         The first word of each command is replaced by the text of an alias if
 326  349         an alias for this word has been defined. An alias name consists of any
 327  350         number of characters excluding metacharacters, quoting characters, file
 328  351         expansion characters, parameter expansion characters, command
 329      -       substitution characters, and =. The replacement string can contain any
 330      -       valid shell script including the metacharacters listed in the Commands
 331      -       section. The first word of each command in the replaced text, other
 332      -       than any that are in the process of being replaced, are tested for
 333      -       aliases. If the last character of the alias value is a BLANK then the
 334      -       word following the alias is also checked for alias substitution.
      352 +       substitution characters, the characters / and =. The replacement string
      353 +       can contain any valid shell script including the metacharacters listed
      354 +       in the Commands section. The first word of each command in the replaced
      355 +       text, other than any that are in the process of being replaced, are
      356 +       tested for aliases. If the last character of the alias value is a BLANK
      357 +       then the word following the alias is also checked for alias
      358 +       substitution.
 335  359  
 336  360  
 337  361         Aliases can be used to redefine built-in commands but cannot be used to
 338  362         redefine the reserved words listed in the Commands section. Aliases can
 339  363         be created and listed with the alias command and can be removed with
 340  364         the unalias command.
 341  365  
 342  366  
 343  367         Aliasing is performed when scripts are read, not while they are
 344  368         executed. For an alias to take effect, the alias definition command has
 345  369         to be executed before the command which references the alias is read.
 346  370         The following aliases are compiled into the shell but can be unset or
 347  371         redefined:
 348  372  
 349  373           autoload='typeset -fu'
 350  374           command='command '
      375 +         compound='typeset -C'
 351  376           fc=hist
 352  377           float='typeset -lE'
 353  378           functions='typeset -f'
 354  379           hash='alias -t --'
 355  380           history='hist -l'
 356  381           integer='typeset -li'
 357  382           nameref='typeset -n'
 358  383           nohup='nohup '
 359  384           r='hist -s'
 360  385           redirect='command exec'
↓ open down ↓ 19 lines elided ↑ open up ↑
 380  405         itself, or in front of a /, is replaced by $HOME. A ~ followed by a +
 381  406         or - is replaced by the value of $PWD and $OLDPWD respectively.
 382  407  
 383  408  
 384  409         In addition, when expanding a variable assignment, tilde substitution
 385  410         is attempted when the value of the assignment begins with a ~, and when
 386  411         a ~ appears after a colon (:). The : also terminates a ~ login name.
 387  412  
 388  413     Command Substitution
 389  414         The standard output from a command enclosed in parentheses preceded by
 390      -       a dollar sign ($) or a pair of grave accents (``) can be used as part
 391      -       or all of a word. Trailing NEWLINEs are removed. In the second
 392      -       (obsolete) form, the string between the quotes is processed for special
 393      -       quoting characters before the command is executed. See Quoting.
      415 +       a dollar sign ( $(list) ), or in a brace group preceded by a dollar
      416 +       sign ( ${ list;} ), or in a pair of grave accents (``) can be used as
      417 +       part or all of a word. Trailing NEWLINEs are removed. In the second
      418 +       case, the { and } are treated as a reserved words so that { must be
      419 +       followed by a blank and } must appear at the beginning of the line or
      420 +       follow a ;. In the third (obsolete) form, the string between the quotes
      421 +       is processed for special quoting characters before the command is
      422 +       executed. See Quoting.
 394  423  
 395  424  
 396  425         The command substitution $(cat file) can be replaced by the equivalent
 397  426         but faster $(<file). The command substitution $(n<#) expands to the
 398      -       current byte offset for file descriptor n.
      427 +       current byte offset for file descriptor n. Except for the second form,
      428 +       the command list is run in a subshell so that no side effects are
      429 +       possible. For the second form, the final } will be recognized as a
      430 +       reserved word after any token.
 399  431  
 400  432     Arithmetic Substitution
 401  433         An arithmetic expression enclosed in double parentheses preceded by a
 402  434         dollar sign ( $((arithmetic_expression))) is replaced by the value of
 403  435         the arithmetic expression within the double parentheses.
 404  436  
 405  437     Process Substitution
 406      -       Process substitution is only available on versions of the UNIX
 407      -       operating system that support the /dev/fd directory for naming open
 408      -       files.
 409      -
 410      -
 411  438         Each command argument of the form <(list) or >(list) runs process list
 412  439         asynchronously connected to some file in /dev/fd. The name of this file
 413  440         becomes the argument to the command. If the form with > is selected
 414  441         then writing on this file provides input for list. If < is used, then
 415  442         the file passed as an argument contains the output of the list process.
 416  443  
 417  444  
 418  445         For example,
 419  446  
 420  447           paste <(cut -f1 file1) <(cut -f3 file2) | tee \
↓ open down ↓ 1 lines elided ↑ open up ↑
 422  449  
 423  450  
 424  451  
 425  452  
 426  453         cuts fields 1 and 3 from the files file1 and file2 respectively, pastes
 427  454         the results together, and sends it to the processes process1 and
 428  455         process2. It also displays the results to the standard output. The
 429  456         file, which is passed as an argument to the command, is a UNIX pipe(2).
 430  457         Programs that expect to lseek(2) on the file do not work.
 431  458  
      459 +       Process substitution of the form <(list) can also be used with the <
      460 +       redirection operator which causes the output of list to be standard
      461 +       input or the input for whatever file descriptor is specified.
      462 +
 432  463     Parameter Expansion
 433  464         A parameter is a variable, one or more digits, or any of the characters
 434  465         *, @, #, ?, -, $, and !. A variable is denoted by a vname. To create a
 435  466         variable whose vname contains a ., a variable whose vname consists of
 436  467         everything before the last . must already exist. A variable has a value
 437  468         and zero or more attributes.  Variables can be assigned values and
 438  469         attributes by using the typeset special built-in command. The
 439  470         attributes supported by the shell are described later with the typeset
 440  471         special built-in command. Exported variables pass values and attributes
 441  472         to the environment.
 442  473  
 443  474  
 444  475         The shell supports both indexed and associative arrays. An element of
 445  476         an array variable is referenced by a subscript. A subscript for an
 446  477         indexed array is denoted by an arithmetic expression, (see Arithmetic
 447      -       Evaluation), between a [ and a ]. Use set -A vname value ... to assign
 448      -       values to an indexed array. The value of all subscripts must be in the
 449      -       range of 0 through 1,048,575. Indexed arrays do not need to be
 450      -       declared. Any reference to a variable with a valid subscript is legal
 451      -       and an array is created if necessary.
      478 +       Evaluation), between a [ and a ].  To assign values to an indexed
      479 +       array, use vname=(value ...) or set -A vname value ... .  The value of
      480 +       all subscripts must be in the range of 0 through 4,194,303. A negative
      481 +       subscript is treated as an offset from the maximum current index +1 so
      482 +       that -1 refers to the last element.  Indexed arrays can be declared
      483 +       with the -a option to typeset. Indexed arrays need not be declared. Any
      484 +       reference to a variable with a valid subscript is legal and an array
      485 +       will be created if necessary.
 452  486  
 453  487  
 454  488         An associative array is created with the -A option to typeset. A
 455  489         subscript for an associative array is denoted by a string enclosed
 456  490         between [ and ].
 457  491  
 458  492  
 459  493         Referencing any array without a subscript is equivalent to referencing
 460  494         the array with subscript 0.
 461  495  
↓ open down ↓ 2 lines elided ↑ open up ↑
 464  498  
 465  499           vname=value [vname=value] ...
 466  500  
 467  501  
 468  502  
 469  503  
 470  504         or
 471  505  
 472  506           vname[subscript]=value [vname[subscript]=value] ...
 473  507  
      508 +       Note that no space is allowed before or after the =.
 474  509  
      510 +       Attributes assigned by the typeset special built-in command apply to
      511 +       all elements of the array.  An array element can be a simple variable,
      512 +       a compound variable or an array variable.  An element of an indexed
      513 +       array can be either an indexed array or an associative array.  An
      514 +       element of an associative array can also be either.  To refer to an
      515 +       array element that is part of an array element, concatenate the
      516 +       subscript in brackets.  For example, to refer to the foobar element of
      517 +       an associative array that is defined as the third element of the
      518 +       indexed array, use ${vname[3][foobar]}
 475  519  
 476  520  
 477      -       No space is allowed before or after the =. A nameref is a variable that
 478      -       is a reference to another variable. A nameref is created with the -n
 479      -       attribute of typeset. The value of the variable at the time of the
 480      -       typeset command becomes the variable that is referenced whenever the
 481      -       nameref variable is used. The name of a nameref cannot contain a dot
 482      -       (.). When a variable or function name contains a ., and the portion of
 483      -       the name up to the first . matches the name of a nameref, the variable
 484      -       referred to is obtained by replacing the nameref portion with the name
 485      -       of the variable referenced by the nameref. If a nameref is used as the
 486      -       index of a for loop, a name reference is established for each item in
 487      -       the list. A nameref provides a convenient way to refer to the variable
 488      -       inside a function whose name is passed as an argument to a function.
 489      -       For example, if the name of a variable is passed as the first argument
 490      -       to a function, the command
      521 +       A nameref is a variable that is a reference to another variable. A
      522 +       nameref is created with the -n attribute of typeset. The value of the
      523 +       variable at the time of the typeset command becomes the variable that
      524 +       is referenced whenever the nameref variable is used. The name of a
      525 +       nameref cannot contain a dot (.). When a variable or function name
      526 +       contains a dot (.) and the portion of the name up to the first .
      527 +       matches the name of a nameref, the variable referred to is obtained by
      528 +       replacing the nameref portion with the name of the variable referenced
      529 +       by the nameref. If a nameref is used as the index of a for loop, a name
      530 +       reference is established for each item in the list. A nameref provides
      531 +       a convenient way to refer to the variable inside a function whose name
      532 +       is passed as an argument to a function. For example, if the name of a
      533 +       variable is passed as the first argument to a function, the command
 491  534  
 492  535            typeset -n var=$1
 493  536  
 494  537  
 495  538  
 496  539  
 497  540         inside the function causes references and assignments to var to be
 498  541         references and assignments to the variable whose name has been passed
 499      -       to the function. If either of the floating point attributes, -E, or -F,
      542 +       to the function. If any of the floating point attributes, -E,-F or -X,
 500  543         or the integer attribute, -i, is set for vname, then the value is
 501  544         subject to arithmetic evaluation as described in this manual page.
 502  545         Positional parameters, parameters denoted by a number, can be assigned
 503  546         values with the set special built-in command. Parameter $0 is set from
 504      -       argument zero when the shell is invoked. The character $ is used to
 505      -       introduce substitutable parameters.
      547 +       argument zero when the shell is invoked.
 506  548  
      549 +       The character $ is used to introduce substitutable parameters.
      550 +
 507  551         ${parameter}
 508  552  
 509  553             The shell reads all the characters from ${ to the matching } as
 510  554             part of the same word even if it contains braces or metacharacters.
 511  555             The value, if any, of the parameter is substituted. The braces are
 512  556             required when parameter is followed by a letter, digit, or
 513      -           underscore that is not to be interpreted as part of its name, when
 514      -           the variable name contains a ., or when a variable is subscripted.
 515      -           If parameter is one or more digits then it is a positional
 516      -           parameter. A positional parameter of more than one digit must be
 517      -           enclosed in braces. If parameter is * or @, then all the positional
 518      -           parameters, starting with $1, are substituted and separated by a
 519      -           field separator character. If an array vname with subscript * or @
 520      -           is used, then the value for each of the elements is substituted,
 521      -           separated by the first character of the value of IFS.
      557 +           underscore that is not to be interpreted as part of its name or
      558 +           when the variable name contains a dot (.). The braces are also
      559 +           required when a variable is subscripted unless it is part of an
      560 +           Arithmetic Expression or a Conditional Expression. If parameter is
      561 +           one or more digits then it is a positional parameter. A positional
      562 +           parameter of more than one digit must be enclosed in braces. If
      563 +           parameter is * or @, then all the positional parameters, starting
      564 +           with $1, are substituted and separated by a field separator
      565 +           character. If an array vname with last subscript * or @ is used, or
      566 +           for index arrays of the form sub1 .. sub2 is used, then the value
      567 +           for each of the elements between sub1 and sub2 inclusive (or all
      568 +           elements for * and @) is substituted, separated by the first
      569 +           character of the value of IFS.
 522  570  
 523  571  
 524  572         ${#parameter}
 525  573  
 526  574             If parameter is * or @, the number of positional parameters is
 527  575             substituted. Otherwise, the length of the value of the parameter is
 528  576             substituted.
 529  577  
 530  578  
 531  579         ${#vname[*]}
 532  580         ${#vname[@]}
 533  581  
 534  582             The number of elements in the array vname is substituted.
 535  583  
      584 +       ${@vname}
 536  585  
      586 +           Expands to the type name or attributes of the variable referred to
      587 +           by vname. See Type Variables.
      588 +
      589 +
 537  590         ${!vname}
 538  591  
 539  592             Expands to the name of the variable referred to by vname. This is
 540  593             vname except when vname is a name reference.
 541  594  
 542  595  
 543  596         ${!vname[subscript]}
 544  597  
 545      -           Expands to name of the subscript unless subscript is * or @.  When
 546      -           subscript is *, the list of array subscripts for vname is
 547      -           generated. For a variable that is not an array, the value is 0 if
 548      -           the variable is set. Otherwise it is null. When subscript is @, it
 549      -           is the same as $ {vname[*]}, except that when used in double
 550      -           quotes, each array subscript yields a separate argument.
      598 +           Expands to name of the subscript unless subscript is * or @, or of
      599 +           the form sub1 .. sub2.  When subscript is *, the list of array
      600 +           subscripts for vname is generated. For a variable that is not an
      601 +           array, the value is 0 if the variable is set, otherwise it is null.
      602 +           When subscript is @, it is the same as $ {vname[*]}, except that
      603 +           when used in double quotes, each array subscript yields a separate
      604 +           argument.  When subscript is of the form sub1 .. sub2 it expands to
      605 +           the list of subscripts between sub1 and sub2 inclusive using the
      606 +           same quoting rules as @.
 551  607  
 552  608  
 553  609         ${!prefix*}
 554  610  
 555  611             Expands to the names of the variables whose names begin with
 556  612             prefix.
 557  613  
 558  614  
 559  615         ${parameter:-word}
 560  616  
 561  617             If parameter is set and is non-null then substitute its value.
 562  618             Otherwise substitute word.
 563  619  
 564      -           word is not evaluated unless it is to be used as the substituted
 565      -           string.
 566  620  
 567      -           In the following example, pwd is executed only if d is not set or
 568      -           is NULL:
 569      -
 570      -             print ${d:-$(pwd)}
 571      -
 572      -
 573      -           If the colon (: ) is omitted from the expression, the shell only
 574      -           checks whether parameter is set or not.
 575      -
 576      -
 577  621         ${parameter:=word}
 578  622  
 579  623             If parameter is not set or is null, set it to word. The value of
 580  624             the parameter is then substituted. Positional parameters cannot be
 581  625             assigned to in this way.
 582  626  
 583      -           word is not evaluated unless it is to be used as the substituted
 584      -           string.
 585  627  
 586      -           In the following example, pwd is executed only if d is not set or
 587      -           is NULL:
 588      -
 589      -             print ${d:-$(pwd)}
 590      -
 591      -
 592      -           If the colon (:) is omitted from the expression, the shell only
 593      -           checks whether parameter is set or not.
 594      -
 595      -
 596  628         ${parameter:?word}
 597  629  
 598  630             If parameter is set and is non-null, substitute its value.
 599  631             Otherwise, print word and exit from the shell , if the shell is not
 600  632             interactive. If word is omitted then a standard message is printed.
 601  633  
 602      -           word is not evaluated unless it is to be used as the substituted
 603      -           string.
 604  634  
 605      -           In the following example, pwd is executed only if d is not set or
 606      -           is NULL:
 607      -
 608      -             print ${d:-$(pwd)}
 609      -
 610      -
 611      -           If the colon (: ) is omitted from the expression, the shell only
 612      -           checks whether parameter is set or not.
 613      -
 614      -
 615  635         ${parameter:+word}
 616  636  
 617  637             If parameter is set and is non-null, substitute word. Otherwise
 618  638             substitute nothing.
 619  639  
 620      -           word is not evaluated unless it is to be used as the substituted
 621      -           string.
      640 +       In the above, word is not evaluated unless it is to be used as the
      641 +       substituted string. In the following example, pwd is executed only if d
      642 +       is not set or is NULL:
 622  643  
 623      -           In the following example, pwd is executed only if d is not set or
 624      -           is NULL:
      644 +         print ${d:-$(pwd)}
 625  645  
 626      -             print ${d:-$(pwd)}
 627  646  
      647 +       If the colon (:) is omitted from the expression, the shell only checks
      648 +       whether parameter is set or not.
 628  649  
 629      -           If the colon (:) is omitted from the expression, the shell only
 630      -           checks whether parameter is set or not.
 631  650  
 632      -
 633  651         ${parameter:offset:length}
 634  652         ${parameter:offset}
 635  653  
 636  654             Expands to the portion of the value of parameter starting at the
 637  655             character (counting from 0) determined by expanding offset as an
 638  656             arithmetic expression and consisting of the number of characters
 639  657             determined by the arithmetic expression defined by length.
 640  658  
 641  659             In the second form, the remainder of the value is used. A negative
 642  660             offset counts backwards from the end of parameter.
↓ open down ↓ 88 lines elided ↑ open up ↑
 731  749                            the environment. It is subsequently assigned the
 732  750                            last argument of the previous command.
 733  751  
 734  752                            This parameter is not set for commands which are
 735  753                            asynchronous. This parameter is also used to hold
 736  754                            the name of the matching MAIL file when checking for
 737  755                            mail.
 738  756  
 739  757  
 740  758         !
 741      -                          The process number of the last background command
 742      -                          invoked or the most recent job put in the background
 743      -                          with the bg built-in command.
      759 +                          The process id or the pool name and job number of
      760 +                          the last background command invoked or the most
      761 +                          recent job put in the background with the bg built-
      762 +                          in command. Background jobs started in a named pool
      763 +                          with be in the form pool.number where pool is the
      764 +                          pool name and number is the job number within that
      765 +                          pool.
 744  766  
 745  767  
 746  768         .sh.command
 747  769                            When processing a DEBUG trap, this variable contains
 748  770                            the current command line that is about to run.
 749  771  
 750  772  
 751  773         .sh.edchar
 752  774                            This variable contains the value of the keyboard
 753  775                            character (or sequence of characters if the first
↓ open down ↓ 37 lines elided ↑ open up ↑
 791  813                            An indexed array which stores the most recent match
 792  814                            and sub-pattern matches after conditional pattern
 793  815                            matches that match and after variables expansions
 794  816                            using the operators #, %, or /. The 0th element
 795  817                            stores the complete match and the ith element stores
 796  818                            the ith sub-match.  The .sh.match variable is unset
 797  819                            when the variable that has expanded is assigned a
 798  820                            new value.
 799  821  
 800  822  
      823 +       .sh.math
      824 +                          Used for defining arithmetic functions (see
      825 +                          Arithmetic evaluation) and stores the list of user-
      826 +                          defined arithmetic functions.
      827 +
      828 +
 801  829         .sh.name
 802  830                            Set to the name of the variable at the time that a
 803  831                            discipline function is invoked.
 804  832  
 805  833  
 806  834         .sh.subscript
 807  835                            Set to the name subscript of the variable at the
 808  836                            time that a discipline function is invoked.
 809  837  
 810  838  
 811  839         .sh.subshell
 812  840                            The current depth for sub-shells and command
 813  841                            substitution.
 814  842  
 815  843  
 816  844         .sh.value
 817  845                            Set to the value of the variable at the time that
 818  846                            the set or append discipline function is invoked.
      847 +                          When a user-defined arithmetic function is invoked,
      848 +                          the value of .sh.value is saved and .sh.value is set
      849 +                          to long double precision floating point. .sh.value
      850 +                          is restored when the function returns.
 819  851  
 820  852  
 821  853         .sh.version
 822  854                            Set to a value that identifies the version of this
 823  855                            shell.
 824  856  
 825  857  
 826  858         LINENO
 827  859                            The current line number within the script or
 828  860                            function being executed.
↓ open down ↓ 37 lines elided ↑ open up ↑
 866  898  
 867  899         SECONDS
 868  900                            Each time this variable is referenced, the number of
 869  901                            seconds since shell invocation is returned. If this
 870  902                            variable is assigned a value, then the value
 871  903                            returned upon reference is the value that was
 872  904                            assigned plus the number of seconds since the
 873  905                            assignment.
 874  906  
 875  907  
      908 +       SHLVL
      909 +                          An integer variable the is incremented each time the
      910 +                          shell is invoked and is exported.  If SHLVL is not
      911 +                          in the environment when the shell is invoked, it is
      912 +                          set to 1.
 876  913  
      914 +
      915 +
 877  916         The following variables are used by the shell:
 878  917  
 879  918         CDPATH
 880  919                       Defines the search path for the cd command.
 881  920  
 882  921  
 883  922         COLUMNS
 884  923                       Defines the width of the edit window for the shell edit
 885  924                       modes and for printing select lists.
 886  925  
↓ open down ↓ 88 lines elided ↑ open up ↑
 975 1014                       characters in IFS that belong to the issspace character
 976 1015                       class, delimit a field. In addition, if the same issspace
 977 1016                       character appears consecutively inside IFS, this
 978 1017                       character is treated as if it were not in the issspace
 979 1018                       class, so that if IFS consists of two tab characters,
 980 1019                       then two adjacent tab characters delimit a null field.
 981 1020  
 982 1021                       The shell specifies a default value to IFS.
 983 1022  
 984 1023  
     1024 +       JOBMAX
     1025 +                     This variable defines the maximum number running
     1026 +                     background jobs that can run at a time.  When this limit
     1027 +                     is reached, the shell will wait for a job to complete
     1028 +                     before staring a new job.
     1029 +
     1030 +
 985 1031         LANG
 986 1032                       This variable determines the locale category for any
 987 1033                       category not specifically selected with a variable
 988 1034                       starting with LC_ or LANG.
 989 1035  
 990 1036  
 991 1037         LC_ALL
 992 1038                       This variable overrides the value of the LANG variable
 993 1039                       and any other LC_ variable.
 994 1040  
↓ open down ↓ 248 lines elided ↑ open up ↑
1243 1289  
1244 1290  
1245 1291         ?
1246 1292                    Matches any single character.
1247 1293  
1248 1294  
1249 1295         [...]
1250 1296                    Match any one of the enclosed characters. A pair of
1251 1297                    characters separated by - matches any character lexically
1252 1298                    between the pair, inclusive. If the first character
1253      -                  following the opening [ is a !, any character not enclosed
1254      -                  is matched. A - can be included in the character set by
1255      -                  putting it as the first or last character. Within [ and ],
1256      -                  character classes can be specified with the syntax [:class:]
1257      -                  where class is one of the following classes defined in the
1258      -                  ANSI-C standard:
     1299 +                  following the opening [ is a ! or ^, any character not
     1300 +                  enclosed is matched. A - can be included in the character
     1301 +                  set by putting it as the first or last character. Within [
     1302 +                  and ], character classes can be specified with the syntax
     1303 +                  [:class:] where class is one of the following classes
     1304 +                  defined in the ANSI-C standard:
1259 1305  
1260 1306                      alnum alpha blank cntrl digit graph
1261 1307                      lower print punct space upper
1262 1308                      word xdigit
1263 1309  
1264 1310  
1265 1311                    word is equivalent to alnum plus the character _. Within [
1266 1312                    and ], an equivalence class can be specified with the syntax
1267 1313                    [=c=] which matches all characters with the same primary
1268 1314                    collation weight (as defined by the current locale) as the
↓ open down ↓ 119 lines elided ↑ open up ↑
1388 1434  
1389 1435         Each sub-pattern in a composite pattern is numbered, starting at 1, by
1390 1436         the location of the ( within the pattern. The sequence \n, where n is a
1391 1437         single digit and \n comes after the nth.  sub-pattern, matches the same
1392 1438         string as the sub-pattern itself.
1393 1439  
1394 1440  
1395 1441         A pattern can contain sub-patterns of the form ~(options:pattern-list),
1396 1442         where either options or :pattern-list can be omitted. Unlike the other
1397 1443         compound patterns, these sub-patterns are not counted in the numbered
1398      -       sub-patterns. If options is present, it can consist of one or more of
1399      -       the following:
     1444 +       sub-patterns. :pattern-list must be omitted for options F, G, N and V
     1445 +       below.  If options is present, it can consist of one or more of the
     1446 +       following:
1400 1447  
1401 1448         +
1402 1449              Enable the following options. This is the default.
1403 1450  
1404 1451  
1405 1452         -
1406 1453              Disable the following options.
1407 1454  
1408 1455  
1409 1456         E
↓ open down ↓ 37 lines elided ↑ open up ↑
1447 1494              with file name generation, and no matches occur, the file pattern
1448 1495              expands to the empty string.
1449 1496  
1450 1497  
1451 1498         r
1452 1499              Right anchor the pattern.
1453 1500  
1454 1501              This is the default for K style patterns.
1455 1502  
1456 1503  
     1504 +       X
     1505 +            The remainder of the pattern uses augmented regular expression
     1506 +            syntax.
1457 1507  
1458      -       If both options and :pattern-list are specified, then the options apply
1459      -       only to pattern-list. Otherwise, these options remain in effect until
1460      -       they are disabled by a subsequent ~(...) or at the end of the sub-
1461      -       pattern containing ~(...).
1462 1508  
1463      -   Quoting
1464      -       Each of the metacharacters listed in the Definitions has a special
1465      -       meaning to the shell.
     1509 +       P
     1510 +            The remainder of the pattern uses perl(1) regular expression
     1511 +            syntax. Not all perl regular expression syntax is currently
     1512 +            implemented.
1466 1513  
1467      -       g
1468      -            File the longest match (greedy). This is the default.
1469 1514  
     1515 +       V
     1516 +            The remainder of the pattern uses System V regular expression
     1517 +            syntax.
1470 1518  
1471      -       i
1472      -            Treat the match as case insensitive.
1473 1519  
1474 1520  
1475      -
1476 1521         If both options and :pattern-list are specified, then the options apply
1477      -       only to pattern-list. Otherwise, the options remain in effect until
     1522 +       only to pattern-list. Otherwise, these options remain in effect until
1478 1523         they are disabled by a subsequent ~(...) or at the end of the sub-
1479 1524         pattern containing ~(...).
1480 1525  
1481      -
     1526 +   Quoting
1482 1527         Each of the metacharacters listed in the Definitions section of this
1483 1528         manual page has a special meaning to the shell and causes termination
1484 1529         of a word unless quoted. A character can be quoted, that is, made to
1485 1530         stand for itself, by preceding it with a backslash (\). The pair
1486 1531         \NEWLINE is removed.  All characters enclosed between a pair of single
1487 1532         quote marks ('') that is not preceded by a $ are quoted. A single quote
1488 1533         cannot appear within the single quotes. A single quoted string preceded
1489 1534         by an unquoted $ is processed as an ANSI-C string except for the
1490 1535         following:
1491 1536  
↓ open down ↓ 19 lines elided ↑ open up ↑
1511 1556  
1512 1557  
1513 1558         Inside double quote marks (""), parameter and command substitution
1514 1559         occur and \ quotes the characters \, `, ", and $. A $ in front of a
1515 1560         double quoted string is ignored in the C or POSIX locale, and might
1516 1561         cause the string to be replaced by a locale specific string otherwise.
1517 1562         The meaning of $* and $@ is identical when not quoted or when used as a
1518 1563         variable assignment value or as a file name.  However, when used as a
1519 1564         command argument, "$*" is equivalent to "$1d$2d...", where d is the
1520 1565         first character of the IFS variable, whereas "$@" is equivalent to "$1"
1521      -       "$2" .... Inside grave quote marks (``), \fR quotes the characters \,
1522      -       `, and $. If the grave quotes occur within double quotes, then \ also
     1566 +       "$2" .... Inside grave quote marks (``), \ quotes the characters \, `,
     1567 +       and $. If the grave quotes occur within double quotes, then \ also
1523 1568         quotes the character ".
1524 1569  
1525 1570  
1526 1571         The special meaning of reserved words or aliases can be removed by
1527 1572         quoting any character of the reserved word. The recognition of function
1528 1573         names or built-in command names cannot be altered by quoting them.
1529 1574  
1530 1575     Arithmetic Evaluation
1531 1576         The shell performs arithmetic evaluation for arithmetic substitution,
1532 1577         to evaluate an arithmetic command, to evaluate an indexed array
1533 1578         subscript, and to evaluate arguments to the built-in commands shift and
1534 1579         let.  Arithmetic evaluation is also performed on argument operands of
1535 1580         the built-in command printf that correspond to numeric format
1536 1581         specifiers in the format operand. See printf(1). Evaluations are
1537 1582         performed using double precision floating point arithmetic or long
1538 1583         double precision floating point for systems that provide this data
1539 1584         type. Floating point constants follow the ANSI-C programming language
1540      -       floating point conventions. Integer constants follow the ANSI-C
1541      -       programming language integer constant conventions although only single
1542      -       byte character constants are recognized and character casts are not
1543      -       recognized. Constants can be of the form [base#]n where base is a
1544      -       decimal number between two and sixty-four representing the arithmetic
1545      -       base and n is a number in that base. The digits greater than 9 are
1546      -       represented by the lower case letters, the upper case letters, @, and _
1547      -       respectively. For bases less than or equal to 36, upper and lower case
1548      -       characters can be used interchangeably.
     1585 +       floating point conventions. The floating point constants Nan and Inf
     1586 +       can be used to represent "not a number" and infinity respectively.
     1587 +       Integer constants follow the ANSI-C programming language integer
     1588 +       constant conventions although only single byte character constants are
     1589 +       recognized and character casts are not recognized. Constants can be of
     1590 +       the form [base#]n where base is a decimal number between two and sixty-
     1591 +       four representing the arithmetic base and n is a number in that base.
     1592 +       The digits greater than 9 are represented by the lower case letters,
     1593 +       the upper case letters, @, and _ respectively. For bases less than or
     1594 +       equal to 36, upper and lower case characters can be used
     1595 +       interchangeably.
1549 1596  
1550 1597  
1551 1598         An arithmetic expression uses the same syntax, precedence, and
1552 1599         associativity of expression as the C language. All the C language
1553 1600         operators that apply to floating point quantities can be used. In
1554 1601         addition, the operator ** can be used for exponentiation. It has higher
1555 1602         precedence than multiplication and is left associative. When the value
1556 1603         of an arithmetic variable or subexpression can be represented as a long
1557 1604         integer, all C language integer arithmetic operations can be performed.
1558 1605         Variables can be referenced by name within an arithmetic expression
1559 1606         without using the parameter expansion syntax. When a variable is
1560 1607         referenced, its value is evaluated as an arithmetic expression.
1561 1608  
1562 1609  
1563 1610         Any of the following math library functions that are in the C math
1564 1611         library can be used within an arithmetic expression:
1565 1612  
1566      -         abs acos acosh asin asinh atan atan2 atanh cbrt
1567      -         copysign cos cosh erf erfc exp exp2 expm1 fabs
1568      -         fdim finite floor fma fmax fmod hypot ilogb
1569      -         int isinf isnan lgamma log log2 logb
1570      -         nearbyint nextafter nexttoward pow remainder
1571      -         rint round sin sinh sqrt tan tanh tgamma trunc
     1613 +         rint round sin sinh sqrt tan tanh tgamma trunc abs acos
     1614 +         acosh asin asinh atan atan2 atanh cbrt ceil copysign cos
     1615 +         cosh erf erfc exp exp2 expm1 fabs fpclassify fdim finite
     1616 +         floor fma fmax fmin fmod hypot ilogb int isfinite sinf isnan
     1617 +         isnormal issubnormal issubor- dered iszero j0 j1 jn lgamma
     1618 +         log log10 log2 logb nearbyint nextafter nexttoward pow
     1619 +         remainder rint round scanb signbit sin sinh sqrt tan tanh
     1620 +         tgamma trunc y0 y1 yn
1572 1621  
1573 1622  
1574 1623  
1575 1624  
     1625 +       In addition, arithmetic functions can be defined as shell functions
     1626 +       with a variant of the function name syntax:
     1627 +
     1628 +       function .sh.math.name ident ... { list ;}
     1629 +            where name is the function name used in the arithmetic expression
     1630 +            and each identified ident is a name reference to the long double
     1631 +            precision floating point argument. The value of .sh.value when the
     1632 +            function returns is the value of this function. User defined
     1633 +            functions can take up to 3 arguments and override C math library
     1634 +            functions.
     1635 +
     1636 +
     1637 +
1576 1638         An internal representation of a variable as a double precision floating
1577      -       point can be specified with the -E [n] or -F [n] option of the typeset
1578      -       special built-in command. The -E option causes the expansion of the
1579      -       value to be represented using scientific notation when it is expanded.
1580      -       The optional option argument n defines the number of significant
1581      -       figures. The -F option causes the expansion to be represented as a
1582      -       floating decimal number when it is expanded.  The optional option
1583      -       argument n defines the number of places after the decimal point in this
1584      -       case.
     1639 +       point can be specified with the -E [n], -F [n], or -X [n] options of
     1640 +       the typeset special built-in command. The -E option causes the
     1641 +       expansion of the value to be represented using scientific notation when
     1642 +       it is expanded. The optional option argument n defines the number of
     1643 +       significant figures. The -F option causes the expansion to be
     1644 +       represented as a floating decimal number when it is expanded.  The
     1645 +       optional option argument n defines the number of places after the
     1646 +       decimal point in this case. The -X option causes the expansion to be
     1647 +       represented using the %a format defined by ISO C-99. The optional
     1648 +       option argument n defines the number of places after the decimal (or
     1649 +       radix) point in this case.
1585 1650  
1586 1651  
     1652 +
1587 1653         An internal integer representation of a variable can be specified with
1588 1654         the -i [n] option of the typeset special built-in command. The optional
1589 1655         option argument n specifies an arithmetic base to be used when
1590 1656         expanding the variable. If you do not specify an arithmetic base, base
1591 1657         10 is used.
1592 1658  
1593 1659  
1594 1660         Arithmetic evaluation is performed on the value of each assignment to a
1595      -       variable with the -E, -F, or -i option. Assigning a floating point
     1661 +       variable with the -E, -F, -X or -i option. Assigning a floating point
1596 1662         number to a variable whose type is an integer causes the fractional
1597 1663         part to be truncated.
1598 1664  
1599 1665     Prompting
1600 1666         When used interactively, the shell prompts with the value of PS1 after
1601 1667         expanding it for parameter expansion, command substitution, and
1602 1668         arithmetic substitution, before reading a command. In addition, each
1603 1669         single ! in the prompt is replaced by the command number. A !! is
1604 1670         required to place ! in the prompt. If at any time a NEWLINE is typed
1605 1671         and further input is needed to complete a command, then the secondary
↓ open down ↓ 85 lines elided ↑ open up ↑
1691 1757         -p file
1692 1758                              True, if file exists and is a FIFO special file or
1693 1759                              a pipe.
1694 1760  
1695 1761  
1696 1762         -r file
1697 1763                              True, if file exists and is readable by current
1698 1764                              process.
1699 1765  
1700 1766  
     1767 +       -R name
     1768 +                            True if variable name is a name reference.
     1769 +
     1770 +
1701 1771         -s file
1702 1772                              True, if file exists and has size greater than
1703 1773                              zero.
1704 1774  
1705 1775  
1706 1776         -S file
1707 1777                              True, if file exists and is a socket.
1708 1778  
1709 1779  
1710 1780         -t fildes
1711 1781                              True, if file descriptor number fildes is open and
1712 1782                              associated with a terminal device.
1713 1783  
1714 1784  
1715 1785         -u file
1716 1786                              True, if file exists and it has its setuid bit
1717 1787                              set.
1718 1788  
1719 1789  
     1790 +       -v name
     1791 +                            True, if variable name is a valid variable name
     1792 +                            and is set.
     1793 +
     1794 +
1720 1795         -w file
1721 1796                              True, if file exists and is writable by current
1722 1797                              process.
1723 1798  
1724 1799  
1725 1800         -x file
1726 1801                              True, if file exists and is executable by current
1727 1802                              process. If file exists and is a directory, then
1728 1803                              true if the current process has permission to
1729 1804                              search in the directory.
↓ open down ↓ 49 lines elided ↑ open up ↑
1779 1854         string1 < string2
1780 1855                              True, if string1 comes before string2 based on
1781 1856                              ASCII value of their characters.
1782 1857  
1783 1858  
1784 1859         string1 > string2
1785 1860                              True, if string1 comes after string2 based on
1786 1861                              ASCII value of their characters.
1787 1862  
1788 1863  
1789      -
1790      -       In each of the following expressions, if file is of the form /dev/fd/n,
     1864 +       In each of the above expressions, if file is of the form /dev/fd/n,
1791 1865         where n is an integer, the test is applied to the open file whose
1792      -       descriptor number is n. The following obsolete arithmetic comparisons
1793      -       are supported:
     1866 +       descriptor number is n.
1794 1867  
     1868 +
     1869 +       The following obsolete arithmetic comparisons are also supported:
     1870 +
1795 1871         exp1 -eq exp2
1796 1872                          True, if exp1 is equal to exp2.
1797 1873  
1798 1874  
1799 1875         exp1 -ge exp2
1800 1876                          True, if exp1 is greater than or equal to exp2.
1801 1877  
1802 1878  
1803 1879         exp1 -gt exp2
1804 1880                          True, if exp1 is greater than exp2.
↓ open down ↓ 63 lines elided ↑ open up ↑
1868 1944                       Use file word as standard output (file descriptor 1). If
1869 1945                       the file does not exist then it is created. If the file
1870 1946                       exists, and the noclobber option is on, this causes an
1871 1947                       error. Otherwise, it is truncated to zero length.
1872 1948  
1873 1949  
1874 1950         >|word
1875 1951                       Same as >, except that it overrides the noclobber option.
1876 1952  
1877 1953  
     1954 +       >;word
     1955 +                     Write output to a temporary file.  If the command
     1956 +                     completes successfully rename it to word, otherwise,
     1957 +                     delete the temporary file.  >;word cannot be used with
     1958 +                     the exec(2) built-in.
     1959 +
     1960 +
1878 1961         >>word
1879 1962                       Use file word as standard output. If the file exists,
1880 1963                       then output is appended to it (by first seeking to the
1881 1964                       end-of-file). Otherwise, the file is created.
1882 1965  
1883 1966  
1884 1967         <>word
1885 1968                       Open file word for reading and writing as standard input.
1886 1969  
1887 1970  
↓ open down ↓ 240 lines elided ↑ open up ↑
2128 2211         .sh.value is unset inside the discipline, then that value is unchanged.
2129 2212         If the unset discipline is defined for a variable, it is invoked
2130 2213         whenever the specified variable is unset. The variable is not unset
2131 2214         unless it is unset explicitly from within this discipline function.
2132 2215  
2133 2216  
2134 2217         The variable .sh.name contains the name of the variable for which the
2135 2218         discipline function is called, .sh.subscript is the subscript of the
2136 2219         variable, and .sh.value contains the value being assigned inside the
2137 2220         set discipline function. For the set discipline, changing .sh.value
2138      -       changes the value that gets assigned.
     2221 +       changes the value that gets assigned.  The variable _ is a reference to
     2222 +       the variable including the subscript if any. For the set discipline,
     2223 +       changing .sh.value will change the value that gets assigned. Finally,
     2224 +       the expansion ${ var.name}, when name is the name of a discipline, and
     2225 +       there is no variable of this name, is equivalent to the command
     2226 +       substitution ${var.name;}.
2139 2227  
     2228 +
     2229 +   Name Spaces
     2230 +       Commands and functions that are executed as part of the list of a
     2231 +       namespace command that modify variables or create new ones, create a
     2232 +       new variable whose name is the name of the name space as given by
     2233 +       identifier preceded by two dots (..).  When a variable whose name is
     2234 +       name is referenced, it is first searched for using .identifier.name.
     2235 +       Similarly, a function defined by a command in the namespace list is
     2236 +       created using the name space name preceded by two dots (..).
     2237 +
     2238 +       When  the list of a namespace command contains a namespace command, the
     2239 +       names of variables and functions that are created consist of the
     2240 +       variable or function name preceded by the list of identifiers each
     2241 +       preceded by two dots (..).
     2242 +
     2243 +       Outside of a name space, a variable or function created inside a name
     2244 +       space can be referenced by preceding it with the name space name.
     2245 +
     2246 +       By default, variables staring with .sh are in the sh name space.
     2247 +
     2248 +
     2249 +   Typed Variables
     2250 +       Typed variables provide a way to create data structure and objects. A
     2251 +       type can be defined either by a shared library, by the enum built-in
     2252 +       command described below, or by using the new -T option of the typeset
     2253 +       built-in command. With the -T option of typeset, the type name,
     2254 +       specified as an option argument to -T, is set with a compound variable
     2255 +       assignment that defines the type. Function definitions can appear
     2256 +       inside the compound variable assignment and these become discipline
     2257 +       functions for this type and can be invoked or redefined by each
     2258 +       instance of the type. The function name create is treated specially. It
     2259 +       is invoked for each instance of the type that is created but is not
     2260 +       inherited and cannot be redefined for each instance.
     2261 +
     2262 +       When a type is defined a special built-in command of that name is
     2263 +       added.  These built-ins are declaration commands and follow the same
     2264 +       expansion rules as all the special built-in commands defined below that
     2265 +       are preceded by a dot (.). These commands can subsequently be used
     2266 +       inside further type definitions. The man page for these commands can be
     2267 +       generated by using the --man option or any of the other -- options
     2268 +       described with getopts. The -r, -a, -A, -h and -S options of typeset
     2269 +       are permitted with each of these new built-ins.
     2270 +
     2271 +       An instance of a type is created by invoking the type name followed by
     2272 +       one or more instance names.  Each instance of the type is initialized
     2273 +       with a copy of the sub-variables except for sub-variables that are
     2274 +       defined with the -s option. Variables defined with -S are shared by all
     2275 +       instances of the type. Each instance can change the value of any sub-
     2276 +       variable and can also define new discipline functions of the same names
     2277 +       as those defined by the type definition as well as any standard
     2278 +       discipline names. No additional sub-variables can be defined for any
     2279 +       instance.
     2280 +
     2281 +       When defining a type, if the value of a sub-variable is not set and the
     2282 +       -r attribute is specified, it causes the sub-variable to be a required
     2283 +       sub-variable. Whenever an instance of a type is created, all required
     2284 +       sub-variables must be specified. These sub-variables become readonly in
     2285 +       each instance.
     2286 +
     2287 +       When unset is invoked on a sub-variable within a type, and the -r
     2288 +       attribute has not been specified for this field, the value is reset to
     2289 +       the default value associative with the type. Invoking unset on a type
     2290 +       instance not contained within another type deletes all sub-variables
     2291 +       and the variable itself.
     2292 +
     2293 +       A type definition can be derived from another type definition by
     2294 +       defining the first sub-variable name as _ and defining its type as the
     2295 +       base type. Any remaining definitions will be additions and
     2296 +       modifications that apply to the new type. If the new type name is the
     2297 +       same is that of the base type, the type will be replaced and the
     2298 +       original type will no longer be accessible.
     2299 +
     2300 +       The typeset command with -T and no option argument or operands will
     2301 +       write all the type definitions to standard output in a form that that
     2302 +       can be read in to create all the types.
     2303 +
     2304 +
2140 2305     Jobs
2141 2306         If the monitor option of the set command is turned on, an interactive
2142 2307         shell associates a job with each pipeline. It keeps a table of current
2143 2308         jobs, printed by the jobs command, and assigns them small integer
2144 2309         numbers. When a job is started asynchronously with &, the shell prints
2145 2310         a line which looks like:
2146 2311  
2147 2312           [1] 1234
2148 2313  
2149 2314  
↓ open down ↓ 13 lines elided ↑ open up ↑
2163 2328         output and unread input are discarded when it is typed.
2164 2329  
2165 2330  
2166 2331         A job being run in the background stops if it tries to read from the
2167 2332         terminal.  Background jobs are normally allowed to produce output, but
2168 2333         this can be disabled by giving the command sttytostop. If you set this
2169 2334         tty option, then background jobs stop when they try to produce output
2170 2335         like they do when they try to read input.
2171 2336  
2172 2337  
     2338 +       A job pool is a collection of jobs started with list & associated with
     2339 +       a name.
     2340 +
     2341 +
2173 2342         There are several ways to refer to jobs in the shell. A job can be
2174 2343         referred to by the process id of any process of the job or by one of
2175 2344         the following:
2176 2345  
2177 2346         %number
2178 2347                     The job with the specified number.
2179 2348  
2180 2349  
     2350 +       pool
     2351 +                   All the jobs in the job pool named by pool.
     2352 +
     2353 +
     2354 +       pool.number
     2355 +                   The job number number in the pool named by pool.
     2356 +
     2357 +
2181 2358         %string
2182 2359                     Any job whose command line begins with string.
2183 2360  
2184 2361  
2185 2362         %?string
2186 2363                     Any job whose command line contains string.
2187 2364  
2188 2365  
2189 2366         %%
2190 2367                     Current job.
2191 2368  
2192 2369  
2193 2370         %+
2194 2371                     Equivalent to %%.
2195 2372  
2196 2373  
2197 2374         %-
2198 2375                     Previous job.
2199 2376  
2200 2377  
     2378 +       In addition, unless noted otherwise, wherever a job can be specified,
     2379 +       the name of a background job pool can be used to represent all the jobs
     2380 +       in that pool.
2201 2381  
     2382 +
     2383 +
2202 2384         The shell learns immediately whenever a process changes state. It
2203 2385         normally informs you whenever a job becomes blocked so that no further
2204 2386         progress is possible, but only just before it prints a prompt. This is
2205 2387         done so that it does not otherwise disturb your work. The notify option
2206 2388         of the set command causes the shell to print these job change messages
2207 2389         as soon as they occur.
2208 2390  
2209 2391  
2210 2392         When the monitor option is on, each background job that completes
2211 2393         triggers any trap set for CHLD.
↓ open down ↓ 22 lines elided ↑ open up ↑
2234 2416         then reset to the arguments of the function call. A function is also
2235 2417         executed in the current shell process.  When the function completes or
2236 2418         issues a return, the positional parameter list is restored. For
2237 2419         functions defined with the function name syntax, any trap set on EXIT
2238 2420         within the function is executed. The exit value of a function is the
2239 2421         value of the last command executed. If a command name is not a special
2240 2422         built-in command or a user defined function, but it is one of the
2241 2423         built-in commands, it is executed in the current shell process.
2242 2424  
2243 2425  
2244      -       The shell variable PATH defines the search path for the directory
2245      -       containing the command. Alternative directory names are separated by a
2246      -       colon (:). The default path is /bin:/usr/bin:, specifying /bin,
2247      -       /usr/bin, and the current directory in that order. The current
2248      -       directory can be specified by two or more adjacent colons, or by a
2249      -       colon at the beginning or end of the path list. If the command name
2250      -       contains a slash (/), the search path is not used. Otherwise, each
2251      -       directory in the path is searched for an executable file of the
2252      -       specified name that is not a directory. If found, and if the shell
2253      -       determines that there is a built-in version of a command corresponding
2254      -       to a specified pathname, this built-in is invoked in the current
2255      -       process. If found, and this directory is also contained in the value of
2256      -       the FPATH variable, then this file is loaded into the current shell
     2426 +       The shell variables PATH and FPATH define the search path for the
     2427 +       directory containing the command. Alternative directory names are
     2428 +       separated by a colon (:). The default path is /bin:/usr/bin:,
     2429 +       specifying /bin, /usr/bin, and the current directory in that order. The
     2430 +       current directory can be specified by two or more adjacent colons, or
     2431 +       by a colon at the beginning or end of the path list. If the command
     2432 +       name contains a slash (/), the search path is not used. Otherwise, each
     2433 +       directory in the list of directories defined by PATH and FPATH is
     2434 +       checked in order.  If the directory being searched is contained in the
     2435 +       value of the FPATH variable and contains a file whose name matches the
     2436 +       command being searched, then this file is loaded into the current shell
2257 2437         environment as if it were the argument to the . command except that
2258 2438         only preset aliases are expanded, and a function of the specified name
2259      -       is executed as described in this manual page. If not found, and the
2260      -       file .paths is found, and this file contains a line of the form
2261      -       FPATH=path where path is an existing directory, and this directory
2262      -       contains a file of the specified name, then this file is loaded into
2263      -       the current shell environment as if it were the argument to the .
2264      -       special built-in command and a function of the specified name is
2265      -       executed. Otherwise, if found, a process is created and an attempt is
2266      -       made to execute the command using exec(2).
     2439 +       is executed as described in this manual page.
2267 2440  
2268 2441  
2269      -       When an executable is found, the directory where it is found in is
2270      -       searched for a file named .paths. If this file is found and it contains
2271      -       a line of the form BUILTIN_LIB=value, the library named by value is
2272      -       searched for as if it were an option argument to builtin -f, and if it
2273      -       contains a built-in of the specified name this is executed instead of a
2274      -       command by this name. Otherwise, if this file is found and it contains
2275      -       a line of the form name=value in the first or second line, then the
2276      -       environment variable name is modified by prepending the directory
2277      -       specified by value to the directory list. If value is not an absolute
2278      -       directory, then it specifies a directory relative to the directory that
2279      -       the executable was found. If the environment variable name does not
2280      -       already exist it is added to the environment list for the specified
2281      -       command.
     2442 +       If this directory is not in FPATH, the shell first determines whether
     2443 +       there is a built-in version of a command corresponding to a given
     2444 +       pathname and, if so, it is invoked in the current process. If no built-
     2445 +       in is found, the shell checks for a file named .paths in this
     2446 +       directory. If found and there is a line of the form:
2282 2447  
     2448 +         FPATH=path
2283 2449  
     2450 +       where path is an existing directory, then that directory is searched
     2451 +       immediately after the current directory as if it were found in the
     2452 +       FPATH variable. If path does not begin with /, it is checked for
     2453 +       relative to the directory being searched.
     2454 +
     2455 +
     2456 +       The .paths file is then checked for a line of the form:
     2457 +
     2458 +         PLUGIN_LIB=libname [ : libname ] ...
     2459 +
     2460 +       Each library named by libname will be searched for as if it were an
     2461 +       option argument to builtin -f and, if it contains a built-in of the
     2462 +       specified name, this is executed instead of a command by this name.
     2463 +
     2464 +
     2465 +       Any built-in loaded from a library found this way will be associated
     2466 +       with the directory containing the .paths file so it will only execute
     2467 +       if not found in an earlier directory.
     2468 +
     2469 +
     2470 +       Finally, the directory will be checked for a file of the given name.
2284 2471         If the file has execute permission but is not an a.out file, it is
2285 2472         assumed to be a file containing shell commands. A separate shell is
2286 2473         spawned to read it. All non-exported variables are removed in this
2287 2474         case. If the shell command file doesn't have read permission, and/or if
2288 2475         the setuid and setgid bits are set on the file, then the shell executes
2289 2476         an agent whose job it is to set up the permissions and execute the
2290      -       shell with the shell command file passed down as an open file. A
2291      -       parenthesized command is executed in a sub-shell without removing non-
2292      -       exported variables.
     2477 +       shell with the shell command file passed down as an open file.
2293 2478  
     2479 +       If the .paths contains a line of the form:
     2480 +
     2481 +         name=value
     2482 +
     2483 +       in the first or second line, then the environment variable name is
     2484 +       modified by prepending the directory specified by value to the
     2485 +       directory list. If value is not an absolute directory, then it
     2486 +       specifies a directory relative to the directory in which the executable
     2487 +       was found. If the environment variable name does not already exist it
     2488 +       will be added to the environment list for the specified command.
     2489 +
     2490 +       A parenthesized command is executed in a sub-shell without removing
     2491 +       non-exported variables.
     2492 +
     2493 +
2294 2494     Command Re-entry
2295 2495         The text of the last HISTSIZE (default 512) commands entered from a
2296 2496         terminal device is saved in a history file. The file $HOME/.sh_history
2297 2497         is used if the HISTFILE variable is not set or if the file it names is
2298 2498         not writable. A shell can access the commands of all interactive shells
2299 2499         which use the same named HISTFILE. The built-in command hist is used to
2300 2500         list or edit a portion of this file. The portion of the file to be
2301 2501         edited or listed can be selected by number or by giving the first
2302 2502         character or characters of the command. A single command or range of
2303 2503         commands can be specified. If you do not specify an editor program as
↓ open down ↓ 931 lines elided ↑ open up ↑
3235 3435             Exit from the enclosing for, while, until, or select loop, if any.
3236 3436             If n is specified, then break n levels.
3237 3437  
3238 3438  
3239 3439         builtin [-ds ] [-f file] [name ...]
3240 3440  
3241 3441             If name is not specified, and no -f option is specified, the built-
3242 3442             ins are printed on standard output. The -s option prints only the
3243 3443             special built-ins. Otherwise, each name represents the pathname
3244 3444             whose basename is the name of the built-in. The entry point
3245      -           function name is determined by prepending b to the built-in name.
     3445 +           function name is determined by prepending b_ to the built-in name.
     3446 +           A built-in specified by a pathname will only be executed when that
     3447 +           pathname would be found during the path search. Built-ins found in
     3448 +           libraries loaded via the .paths file will be associate with the
     3449 +           pathname of the directory containing the .paths file.
     3450 +
3246 3451             The ISO C/C++ prototype is bmycommand(int argc, char *argv[], void
3247 3452             *context) for the built-in command mycommand where argv is an array
3248 3453             of argc elements and context is an optional pointer to a Shell_t
3249 3454             structure as described in <ast/shell.h> Special built-ins cannot be
3250 3455             bound to a pathname or deleted. The -d option deletes each of the
3251 3456             specified built-ins. On systems that support dynamic loading, the
3252 3457             -f option names a shared library containing the code for built-ins.
3253 3458             The shared library prefix and/or suffix, which depend on the
3254 3459             system, can be omitted. Once a library is loaded, its symbols
3255 3460             become available for subsequent invocations of builtin. Multiple
↓ open down ↓ 73 lines elided ↑ open up ↑
3329 3534         echo [arg ...]
3330 3535  
3331 3536             When the first arg does not begin with a -, and none of the
3332 3537             arguments contain a backslash (\), prints each of its arguments
3333 3538             separated by a SPACE and terminated by a NEWLINE. Otherwise, the
3334 3539             behavior of echo is system dependent and print or printf described
3335 3540             in this section should be used. See echo(1) for usage and
3336 3541             description.
3337 3542  
3338 3543  
     3544 +       ++enum [ -i ] type[=(value ...) ]
     3545 +
     3546 +           Creates a declaration command named type that is an integer type
     3547 +           that allows one of the specified values as enumeration names. If
     3548 +           =(value ...) is omitted, then type must be an indexed array
     3549 +           variable with at least two elements and the values are taken from
     3550 +           this array variable.  If -i is specified the values are case
     3551 +           insensitive.
     3552 +
     3553 +
3339 3554         +eval [arg ...]
3340 3555  
3341 3556             The arguments are read as input to the shell and the resulting
3342 3557             commands are executed.
3343 3558  
3344 3559  
3345 3560         +exec [-c] [-a name ...] [arg ...]
3346 3561  
3347 3562             If arg is specified, the command specified by the arguments is
3348 3563             executed in place of this shell without creating a new process. The
↓ open down ↓ 14 lines elided ↑ open up ↑
3363 3578             value is the least significant 8 bits of the specified status. If n
3364 3579             is omitted, then the exit status is that of the last command
3365 3580             executed. An end-of-file also causes the shell to exit except for a
3366 3581             shell which has the ignoreeof option turned on. See set.
3367 3582  
3368 3583  
3369 3584         ++export [-p] [name[=value]] ...
3370 3585  
3371 3586             If name is not specified, the names and values of each variable
3372 3587             with the export attribute are printed with the values quoted in a
3373      -           manner that allows them to be re-entered. The -p option causes the
3374      -           word export to be inserted before each one. Otherwise, the
3375      -           specified names are marked for automatic export to the environment
3376      -           of subsequently-executed commands.
     3588 +           manner that allows them to be re-entered. The export command is the
     3589 +           same as typeset -x except that if you use export within a function,
     3590 +           no local variable is created. The -p option causes the word export
     3591 +           to be inserted before each one. Otherwise, the specified names are
     3592 +           marked for automatic export to the environment of subsequently-
     3593 +           executed commands.
3377 3594  
3378 3595  
3379 3596         false
3380 3597  
3381 3598             Does nothing, and exits 1. Used with until for infinite loops.
3382 3599  
3383 3600  
3384 3601         fg [job ...]
3385 3602  
3386 3603             This command is only on systems that support job control. Each job
↓ open down ↓ 70 lines elided ↑ open up ↑
3457 3674             Lists information about each specified job, or all active jobs if
3458 3675             job is omitted. The -l option lists process ids in addition to the
3459 3676             normal information. The -n option only displays jobs that have
3460 3677             stopped or exited since last notified. The -p option causes only
3461 3678             the process group to be listed. See Jobs for a description of the
3462 3679             format of job.
3463 3680  
3464 3681  
3465 3682         kill [-s signame] job ...
3466 3683         kill [-n signum] job ...
3467      -       kill -l [sig ...]
     3684 +       kill -Ll [sig ...]
3468 3685  
3469 3686             Sends either the TERM (terminate) signal or the specified signal to
3470 3687             the specified jobs or processes. Signals are either specified by
3471 3688             number with the -n option or by name with the -s option (as
3472 3689             specified in <signal.h>, stripped of the prefix `SIG with the
3473 3690             exception that SIGCLD is named CHLD). For backward compatibility,
3474 3691             the n and s can be omitted and the number or name placed
3475 3692             immediately after the -. If the signal being sent is TERM
3476 3693             (terminate) or HUP (hang up), then the job or process is sent a
3477 3694             CONT (continue) signal if it is stopped. The argument job can be
3478 3695             the process id of a process that is not a member of one of the
3479 3696             active jobs. See Jobs for a description of the format of job. In
3480      -           the third form, kill -l, if sig is not specified, the signal names
3481      -           are listed. Otherwise, for each sig that is a name, the
3482      -           corresponding signal number is listed. For each sig that is a
3483      -           number, the signal name corresponding to the least significant 8
3484      -           bits of sig is listed.
     3697 +           the third form, kill -l or kill -L, if sig is not specified, the
     3698 +           signal names are listed. The -l option lists only the signal names
     3699 +           whereas -L lists each signal name and corresponding number.
     3700 +           Otherwise, for each sig that is a name, the corresponding signal
     3701 +           number is listed. For each sig that is a number, the signal name
     3702 +           corresponding to the least significant 8 bits of sig is listed.
3485 3703  
3486 3704  
3487 3705         let [arg ...]
3488 3706  
3489      -           Each arg is a separate arithmetic expression to be evaluated. See
3490      -           the Arithmetic Evaluation section of this manual page for a
3491      -           description of arithmetic expression evaluation. The exit status is
3492      -           0 if the value of the last expression is non-zero, and 1 otherwise.
     3707 +           Each arg is a separate arithmetic expression to be evaluated.  let
     3708 +           only recognizes octal constants starting with 0 when the set option
     3709 +           letoctal is on. See the Arithmetic Evaluation section of this
     3710 +           manual page for a description of arithmetic expression evaluation.
     3711 +           The exit status is 0 if the value of the last expression is non-
     3712 +           zero, and 1 otherwise.
3493 3713  
3494 3714  
3495 3715         +newgrp [arg ...]
3496 3716  
3497 3717             Equivalent to exec /bin/newgrp arg ...
3498 3718  
3499 3719  
3500      -       print [-Renprs] [ -u unit] [ -f format ] [ arg ...]
     3720 +       print [-CRenprsv] [ -u unit] [ -f format ] [ arg ...]
3501 3721  
3502 3722             With no options or with option - or --, each arg is printed on
3503 3723             standard output. The -f option causes the arguments to be printed
3504 3724             as described by printf. In this case, any e, n, r, or R options are
3505 3725             ignored. Otherwise, unless the -R or -r, are specified, the
3506 3726             following escape conventions are applied:
3507 3727  
3508 3728             \a
3509 3729                     Alert character (ASCII 07)
3510 3730  
↓ open down ↓ 36 lines elided ↑ open up ↑
3547 3767  
3548 3768  
3549 3769             \0x
3550 3770                     Character defined by the 1, 2, or 3-digit octal string
3551 3771                     specified by x
3552 3772  
3553 3773             The -R option prints all subsequent arguments and options other
3554 3774             than -n. The -e causes the escape conventions to be applied This is
3555 3775             the default behavior. It reverses the effect of an earlier -r. The
3556 3776             -p option causes the arguments to be written onto the pipe of the
3557      -           process spawned with |& instead of standard output. The -s option
     3777 +           process spawned with |& instead of standard output. The -v option
     3778 +           treats each arg as a variable name and writes the value in the
     3779 +           printf %B format. The -C option treats each arg as a variable name
     3780 +           and writes the values in the printf %#B format.  The -s option
3558 3781             causes the arguments to be written onto the history file instead of
3559 3782             standard output. The -u option can be used to specify a one digit
3560 3783             file descriptor unit number unit on which the output is placed. The
3561 3784             default is 1. If the option -n is used, no NEWLINE is added to the
3562 3785             output.
3563 3786  
3564 3787  
3565      -       printf format[arg ...]
     3788 +       printf format [arg ...]
3566 3789  
3567 3790             The arguments arg are printed on standard output in accordance with
3568 3791             the ANSI-C formatting rules associated with the format string
3569 3792             format.  If the number of arguments exceeds the number of format
3570 3793             specifications, the format string is reused to format remaining
3571      -           arguments. The following extensions can also be used: A %b format
3572      -           can be used instead of %s to cause escape sequences in the
3573      -           corresponding arg to be expanded as described in print. A %B option
3574      -           causes each of the arguments to be treated as variable names and
3575      -           the binary value of the variables is printed. This is most useful
3576      -           for variables with an attribute of b. A %H format can be used
3577      -           instead of %s to cause characters in arg that are special in HTML
3578      -           and XML to be output as their entity name. A %P format can be used
3579      -           instead of %s to cause arg to be interpreted as an extended regular
3580      -           expression and be printed as a shell pattern. A %R format can be
3581      -           used instead of %s to cause arg to be interpreted as a shell
3582      -           pattern and to be printed as an extended regular expression. A %q
3583      -           format can be used instead of %s to cause the resulting string to
3584      -           be quoted in a manner than can be input again to the shell. A
3585      -           %(date-format)T format can be use to treat an argument as a
3586      -           date/time string and to format the date/time according to the date-
3587      -           format as defined for the date(1) command. A %Z format outputs a
3588      -           byte whose value is 0. The precision field of the %d format can be
3589      -           followed by a .  and the output base. In this case, the # flag
3590      -           character causes base# to be prepended. The # flag when used with
3591      -           the d specifier without an output base, causes the output to be
3592      -           displayed in thousands units with one of the suffixes k M G T P E
3593      -           to indicate the unit. The # flag when used with the i specifier
3594      -           causes the output to be displayed in 1024 with one of the suffixes
3595      -           Ki Mi Gi Ti Pi Ei to indicate the unit. The = flag has been added
3596      -           to center the output within the specified field width.
     3794 +           arguments. The following extensions can also be used:
3597 3795  
3598 3796  
     3797 +           %b
     3798 +
     3799 +               A %b format can be used instead of %s to cause escape sequences
     3800 +               in the corresponding arg to be expanded as described in print.
     3801 +
     3802 +
     3803 +           %B
     3804 +
     3805 +               A %B option causes each of the arguments to be treated as
     3806 +               variable names and the binary value of the variables is
     3807 +               printed. This is most useful for variables with an attribute of
     3808 +               b.
     3809 +
     3810 +
     3811 +           %H
     3812 +
     3813 +               A %H format can be used instead of %s to cause characters in
     3814 +               arg that are special in HTML and XML to be output as their
     3815 +               entity name. The alternate flag # formats the output for use as
     3816 +               a URI.
     3817 +
     3818 +
     3819 +           %P
     3820 +
     3821 +               A %P format can be used instead of %s to cause arg to be
     3822 +               interpreted as an extended regular expression and be printed as
     3823 +               a shell pattern.
     3824 +
     3825 +
     3826 +
     3827 +           %R
     3828 +
     3829 +               A %R format can be used instead of %s to cause arg to be
     3830 +               interpreted as a shell pattern and to be printed as an extended
     3831 +               regular expression.
     3832 +
     3833 +
     3834 +           %q
     3835 +
     3836 +               A %q format can be used instead of %s to cause the resulting
     3837 +               string to be quoted in a manner than can be input again to the
     3838 +               shell. When q is preceded by the alternative format specifier,
     3839 +               #, the string is quoted in manner suitable as a field in a .csv
     3840 +               format file.
     3841 +
     3842 +
     3843 +           %(date-format)
     3844 +
     3845 +               A %(date-format)T format can be use to treat an argument as a
     3846 +               date/time string and to format the date/time according to the
     3847 +               date-format as defined for the date(1) command.
     3848 +
     3849 +
     3850 +
     3851 +           %Z
     3852 +
     3853 +               A %Z format outputs a byte whose value is 0.
     3854 +
     3855 +
     3856 +           %d
     3857 +
     3858 +               The precision field of the %d format can be followed by a . and
     3859 +               the output base. In this case, the # flag character causes
     3860 +               base# to be prepended.
     3861 +
     3862 +
     3863 +           #
     3864 +
     3865 +               The # flag, when used with the %d format without an output
     3866 +               base, displays the output in powers of 1000 indicated by one of
     3867 +               the following suffixes: k M G T P E, and when used with the %i
     3868 +               format displays the output in powers of 1024 indicated by one
     3869 +               of the following suffixes: Ki Mi Gi Ti Pi Ei.
     3870 +
     3871 +
     3872 +
     3873 +           =
     3874 +
     3875 +               The = flag centers the output within the specified field width.
     3876 +
     3877 +
     3878 +           L
     3879 +
     3880 +               The L flag, when used with the %c or %s formats, treats
     3881 +               precision as character width instead of byte count.
     3882 +
     3883 +
     3884 +           ,
     3885 +
     3886 +               The , flag, when used with the %d or %f formats, separates
     3887 +               groups of digits with the grouping delimiter (, in groups of 3
     3888 +               in the C locale).
     3889 +
     3890 +
     3891 +
     3892 +
3599 3893         pwd [-LP]
3600 3894  
3601 3895             Outputs the value of the current working directory. The -L option
3602 3896             is the default. It prints the logical name of the current
3603 3897             directory. If the -P option is specified, all symbolic links are
3604 3898             resolved from the name. The last instance of -L or -P on the
3605 3899             command line determines which method is used.
3606 3900  
3607 3901  
3608      -       read [-Aprs] [-d delim] [ -n n] [[ -N n] [[-t timeout] [-u unit]
     3902 +       read [-ACSprsv] [-d delim] [ -n n] [[ -N n] [[-t timeout] [-u unit]
3609 3903         [vname?prompt] [ vname ... ]
3610 3904  
3611 3905             The shell input mechanism. One line is read and is broken up into
3612 3906             fields using the characters in IFS as separators. The escape
3613 3907             character, \, is used to remove any special meaning for the next
3614 3908             character and for line continuation.  The -d option causes the read
3615 3909             to continue to the first character of delim rather than NEWLINE.
3616 3910             The -n option causes at most n bytes to read rather a full line but
3617 3911             returns when reading from a slow device as soon as any characters
3618 3912             have been read. The -N option causes exactly n to be read unless an
3619 3913             end-of-file has been encountered or the read times out because of
3620 3914             the -t option. In raw mode, -r, the \ character is not treated
3621 3915             specially. The first field is assigned to the first vname, the
3622 3916             second field to the second vname, etc., with leftover fields
3623 3917             assigned to the last vname. When vname has the binary attribute and
3624 3918             -n or -N is specified, the bytes that are read are stored directly
3625 3919             into the variable. If the -v is specified, then the value of the
3626 3920             first vname is used as a default value when reading from a terminal
3627 3921             device. The -A option causes the variable vname to be unset and
3628 3922             each field that is read to be stored in successive elements of the
3629      -           indexed array vname. The -p option causes the input line to be
3630      -           taken from the input pipe of a process spawned by the shell using
3631      -           |&. If the -s option is present, the input is saved as a command in
3632      -           the history file. The option -u can be used to specify a one digit
3633      -           file descriptor unit unit to read from. The file descriptor can be
3634      -           opened with the exec special built-in command. The default value of
3635      -           unit n is 0. The option -t is used to specify a time out in seconds
3636      -           when reading from a terminal or pipe. If vname is omitted, then
3637      -           REPLY is used as the default vname. An end-of-file with the -p
3638      -           option causes cleanup for this process so that another can be
3639      -           spawned. If the first argument contains a ?, the remainder of this
3640      -           word is used as a prompt on standard error when the shell is
3641      -           interactive. The exit status is 0 unless an end-of-file is
3642      -           encountered or read has timed out.
     3923 +           indexed array vname. The -C option causes the variable vname to be
     3924 +           read as a compound variable. Blanks will be ignored when finding
     3925 +           the beginning open parenthesis. The -S option causes the line to be
     3926 +           treated like a record in a .csv format file so that double quotes
     3927 +           can be used to allow the delimiter character and the new-line
     3928 +           character to appear within a field.  The -p option causes the input
     3929 +           line to be taken from the input pipe of a process spawned by the
     3930 +           shell using |&. If the -s option is present, the input is saved as
     3931 +           a command in the history file. The option -u can be used to specify
     3932 +           a one digit file descriptor unit unit to read from. The file
     3933 +           descriptor can be opened with the exec special built-in command.
     3934 +           The default value of unit n is 0. The option -t is used to specify
     3935 +           a time out in seconds when reading from a terminal or pipe. If
     3936 +           vname is omitted, then REPLY is used as the default vname. An end-
     3937 +           of-file with the -p option causes cleanup for this process so that
     3938 +           another can be spawned. If the first argument contains a ?, the
     3939 +           remainder of this word is used as a prompt on standard error when
     3940 +           the shell is interactive. The exit status is 0 unless an end-of-
     3941 +           file is encountered or read has timed out.
3643 3942  
3644 3943  
3645 3944         ++readonly [-p] [ vname[=value]] ...
3646 3945  
3647 3946             If vname is not specified, the names and values of each variable
3648 3947             with the read-only attribute is printed with the values quoted in a
3649 3948             manner that allows them to be input again. The -p option causes the
3650 3949             word readonly to be inserted before each one. Otherwise, the
3651 3950             specified vnames are marked readonly and these names cannot be
3652 3951             changed by subsequent assignment.
↓ open down ↓ 41 lines elided ↑ open up ↑
3694 3993  
3695 3994             -C
3696 3995  
3697 3996                 Prevents redirection (>) from truncating existing files. Files
3698 3997                 that are created are opened with the O_EXCL mode. Requires >|
3699 3998                 to truncate a file when turned on.
3700 3999  
3701 4000  
3702 4001             -e
3703 4002  
3704      -               If a command has a non-zero exit status, execute the ERR trap,
3705      -               if set, and exit. This mode is disabled while reading profiles.
     4003 +               Unless contained in a || or && command, or the command
     4004 +               following an if, while or until command or in the pipeline
     4005 +               following !, if a command has a non-zero exit status, execute
     4006 +               the ERR trap, if set, and exit. This mode is disabled while
     4007 +               reading profiles.
3706 4008  
3707 4009  
3708 4010             -f
3709 4011  
3710 4012                 Disables file name generation.
3711 4013  
3712 4014  
3713 4015             -G
3714 4016  
3715 4017                 Causes the pattern ** by itself to match files and zero or more
↓ open down ↓ 79 lines elided ↑ open up ↑
3795 4097  
3796 4098                     The shell does not exit on end-of-file. The command exit
3797 4099                     must be used.
3798 4100  
3799 4101  
3800 4102                 keyword
3801 4103  
3802 4104                     Same as -k.
3803 4105  
3804 4106  
     4107 +               letoctal
     4108 +
     4109 +                   The let command allows octal constants starting with 0.
     4110 +
     4111 +
3805 4112                 markdirs
3806 4113  
3807 4114                     All directory names resulting from file name generation
3808 4115                     have a trailing / appended.
3809 4116  
3810 4117  
3811 4118                 monitor
3812 4119  
3813 4120                     Same as -m.
3814 4121  
↓ open down ↓ 181 lines elided ↑ open up ↑
3996 4303             is KEYBD, then action is executed whenever a key is read while in
3997 4304             emacs, gmacs, or vi mode. The trap command with no arguments prints
3998 4305             a list of commands associated with each signal number.
3999 4306  
4000 4307  
4001 4308         true
4002 4309  
4003 4310             Does nothing, and exits 0. Used with while for infinite loops.
4004 4311  
4005 4312  
4006      -       ++typeset [+-AHflabnprtux ] [ +-EFLRZi[n] ] [ vname[=value ] ]
     4313 +       ++typeset [+-ACHSfblmnprtux ] [ +-EFLRXZi[n] ] [ +-M [ mapname ] ] [ -T
     4314 +       [ tname=(assign_list) ] ] [ -h str ] [ -a [type] ] [ vname[=value ] ]
4007 4315  
4008 4316             Sets attributes and values for shell variables and functions. When
4009 4317             invoked inside a function defined with the function name syntax, a
4010 4318             new instance of the variable vname is created, and the variable's
4011 4319             value and type are restored when the function completes.
4012 4320  
4013 4321             Using + rather than - causes these options to be turned off. If no
4014 4322             vname arguments are specified, a list of vnames (and optionally the
4015 4323             values) of the variables is printed. Using + rather than - keeps
4016 4324             the values from being printed.) The -p option causes typeset
↓ open down ↓ 20 lines elided ↑ open up ↑
4037 4345                   can be text or binary. The value is represented by the base64
4038 4346                   encoding of the data. If -Z is also specified, the size in
4039 4347                   bytes of the data in the buffer is determined by the size
4040 4348                   associated with the -Z. If the base64 string assigned results
4041 4349                   in more data, it is truncated. Otherwise, it is filled with
4042 4350                   bytes whose value is zero. The printf format %B can be used
4043 4351                   to output the actual data in this buffer instead of the
4044 4352                   base64 encoding of the data.
4045 4353  
4046 4354  
     4355 +           -C
     4356 +                 Causes each vname to be a compound variable. If value names a
     4357 +                 compound variable it is copied into vname. Otherwise, it
     4358 +                 unsets each vname.
     4359 +
     4360 +
4047 4361             -E
4048 4362                   Declares vname to be a double precision floating point
4049 4363                   number. If n is non-zero, it defines the number of
4050 4364                   significant figures that are used when expanding vname.
4051 4365                   Otherwise, ten significant figures is used.
4052 4366  
4053 4367  
4054 4368             -f
4055 4369                   The names refer to function names rather than variable names.
4056 4370                   No assignments can be made and the only other valid options
4057 4371                   are -t, -u, and -x. The -t option turns on execution tracing
4058 4372                   for this function. The -u option causes this function to be
4059 4373                   marked undefined. The FPATH variable is searched to find the
4060 4374                   function definition when the function is referenced. If no
4061 4375                   options other than -f is specified, then the function
4062 4376                   definition is displayed on standard output. If +f is
4063 4377                   specified, then a line containing the function name followed
4064 4378                   by a shell comment containing the line number and path name
4065 4379                   of the file where this function was defined, if any, is
4066      -                 displayed.
     4380 +                 displayed.  The names refer to function names rather than
     4381 +                 variable names.  No assignments can be made and the only
     4382 +                 other valid options are -S, -t, -u and -x.  The -S can be
     4383 +                 used with discipline functions defined in a type to indicate
     4384 +                 that the function is static. For a static function, the same
     4385 +                 method will be used by all instances of that type no matter
     4386 +                 which instance references it. In addition, it can only use
     4387 +                 value of variables from the original type definition. These
     4388 +                 discipline functions cannot be redefined in any type
     4389 +                 instance.  The -t option turns on execution tracing for this
     4390 +                 function.  The -u option causes this function to be marked
     4391 +                 undefined.  The FPATH variable will be searched to find the
     4392 +                 function definition when the function is referenced.  If no
     4393 +                 options other than -f is specified, then the function
     4394 +                 definition will be displayed on standard output. If +f is
     4395 +                 specified, then a line containing the function name followed
     4396 +                 by a shell comment containing the line number and path name
     4397 +                 of the file where this function was defined, if any, is
     4398 +                 displayed. The exit status can be used to determine whether
     4399 +                 the function is defined so that typeset -f .sh.math. name
     4400 +                 will return 0 when math function name is defined and non-zero
     4401 +                 otherwise.
4067 4402  
4068 4403                   The -i attribute cannot be specified with -f.
4069 4404  
4070 4405  
4071 4406             -F
4072 4407                   Declares vname to be a double precision floating point
4073 4408                   number. If n is non-zero, it defines the number of places
4074 4409                   after the decimal point that are used when expanding vname.
4075 4410                   Otherwise ten places after the decimal point is used.
4076 4411  
4077 4412  
     4413 +           -h
     4414 +                 Used within type definitions to add information when
     4415 +                 generating information about the sub-variable on the man
     4416 +                 page. It is ignored when used outside of a type definition.
     4417 +                 When used with -f the information is associated with the
     4418 +                 corresponding discipline function.
     4419 +
     4420 +
4078 4421             -H
4079 4422                   This option provides UNIX to hostname file mapping on non-
4080 4423                   UNIX machines.
4081 4424  
4082 4425  
4083 4426             -i
4084 4427                   Declares vname to be represented internally as integer. The
4085 4428                   right hand side of an assignment is evaluated as an
4086 4429                   arithmetic expression when assigning to an integer. If n is
4087 4430                   non-zero, it defines the output arithmetic base, otherwise
4088 4431                   the output base is ten.
4089 4432  
4090 4433                   The -i attribute cannot be specified along with -R, -L, -Z,
4091 4434                   or -f.
4092 4435  
4093 4436  
4094 4437             -l
4095      -                 All uppercase characters are converted to lowercase. The
4096      -                 uppercase option, -u, is turned off.
     4438 +                 Used with -i, -E or -F to indicate long integer, or long
     4439 +                 float.  Otherwise, all upper-case characters are converted to
     4440 +                 lower-case.  The upper-case option, -u, is turned off.
     4441 +                 Equivalent to -M tolower.
4097 4442  
4098 4443  
4099 4444             -L
4100 4445                   Left justify and remove leading blanks from value. If n is
4101 4446                   non-zero, it defines the width of the field, otherwise it is
4102 4447                   determined by the width of the value of first assignment.
4103 4448                   When the variable is assigned to, it is filled on the right
4104 4449                   with blanks or truncated, if necessary, to fit into the
4105 4450                   field. The -R option is turned off.
4106 4451  
4107 4452                   The -i attribute cannot be specified with -L.
4108 4453  
4109 4454  
     4455 +           -m
     4456 +                 moves or renames the variable. The value is the name of a
     4457 +                 variable whose value will be moved to vname. The original
     4458 +                 variable will be unset. Cannot be used with any other
     4459 +                 options.
     4460 +
     4461 +
     4462 +           -M
     4463 +                 Use the character mapping mapping such as tolower and toupper
     4464 +                 when assigning a value to each of the specified operands.
     4465 +                 When mapping is specified and there are not operands, all
     4466 +                 variables that use this mapping are written to standard
     4467 +                 output.  When mapping is omitted and there are no operands,
     4468 +                 all mapped variables are written to standard output.
     4469 +
     4470 +
4110 4471             -n
4111 4472                   Declares vname to be a reference to the variable whose name
4112 4473                   is defined by the value of variable vname. This is usually
4113 4474                   used to reference a variable inside a function whose name has
4114 4475                   been passed as an argument.
4115 4476  
4116 4477  
     4478 +           -p
     4479 +                 The name, attributes and values for the given vname are
     4480 +                 written on standard output in a form that can be used as
     4481 +                 shell input.  If +p is specified, then the values are not
     4482 +                 displayed.
     4483 +
     4484 +
4117 4485             -R
4118 4486                   Right justify and fill with leading blanks. If n is non-zero,
4119 4487                   it defines the width of the field, otherwise it is determined
4120 4488                   by the width of the value of first assignment. The field is
4121 4489                   left filled with blanks or truncated from the end if the
4122 4490                   variable is reassigned. The -L option is turned off.
4123 4491  
4124 4492                   The -i attribute cannot be specified with -R.
4125 4493  
4126 4494  
4127 4495             -r
4128 4496                   The specified vnames are marked read-only and these names
4129 4497                   cannot be changed by subsequent assignment.
4130 4498  
4131 4499  
     4500 +           -S
     4501 +                 When used within the assign_list of a type definition, it
     4502 +                 causes the specified sub-variable to be shared by all
     4503 +                 instances of the type. When used inside a function defined
     4504 +                 with the function reserved word, the specified variables will
     4505 +                 have function static scope. Otherwise, the variable is unset
     4506 +                 prior to processing the assignment list.
     4507 +
     4508 +
4132 4509             -t
4133 4510                   Tags the variables. Tags are user definable and have no
4134 4511                   special meaning to the shell.
4135 4512  
4136 4513  
     4514 +           -T
     4515 +                 If followed by tname, it creates a type named by tname using
     4516 +                 the compound assignment assign_list to tname. Otherwise, it
     4517 +                 writes all the type definitions to standard output.
     4518 +
     4519 +
4137 4520             -u
4138      -                 All lowercase characters are converted to uppercase. The
4139      -                 lowercase option, -l, is turned off.
     4521 +                 When given along with -i specifies unsigned integer.
     4522 +                 Otherwise, all lower-case characters are converted to upper-
     4523 +                 case.  The lower-case option, -l, is turned off.  Equivalent
     4524 +                 to -M toupper.
4140 4525  
4141 4526  
4142 4527             -x
4143 4528                   The specified vnames are marked for automatic export to the
4144 4529                   environment of subsequently-executed commands. Variables
4145 4530                   whose names contain a . cannot be exported.
4146 4531  
4147 4532  
     4533 +           -X
     4534 +                 Declares vname to be a double precision floating point number
     4535 +                 and expands using the %a format of ISO-C99.  If n is non-
     4536 +                 zero, it defines the number of hex digits after the radix
     4537 +                 point that is used when expanding vname.  The default is 10.
     4538 +
     4539 +
4148 4540             -Z
4149 4541                   Right justify and fill with leading zeros if the first non-
4150 4542                   blank character is a digit and the -L option has not been
4151 4543                   set. Remove leading zeros if the -L option is also set. If n
4152 4544                   is non-zero, it defines the width of the field, otherwise it
4153 4545                   is determined by the width of the value of first assignment.
4154 4546  
4155 4547                   The -i attribute cannot be specified with -Z.
4156 4548  
4157 4549  
↓ open down ↓ 157 lines elided ↑ open up ↑
4315 4707  
4316 4708  
4317 4709         -D
4318 4710                        A list of all double quoted strings that are preceded by
4319 4711                        a $ is printed on standard output and the shell exits.
4320 4712                        This set of strings is subject to language translation
4321 4713                        when the locale is not C or POSIX. No commands are
4322 4714                        executed.
4323 4715  
4324 4716  
     4717 +       -E
     4718 +                      Reads the file named by the ENV variable or by
     4719 +                      $HOME/.kshrc if not defined after the profiles.
     4720 +
     4721 +
4325 4722         -i
4326 4723                        If the -i option is present or if the shell input and
4327 4724                        output are attached to a terminal (as told by
4328 4725                        tcgetattr(3C), this shell is interactive. In this case
4329 4726                        TERM is ignored (so that kill 0 does not kill an
4330 4727                        interactive shell) and INTR is caught and ignored (so
4331 4728                        that wait is interruptible). In all cases, QUIT is
4332 4729                        ignored by the shell.
4333 4730  
4334 4731  
     4732 +       -P
     4733 +                      If -P or -o profile is present, the shell is a profile
     4734 +                      shell (see pfexec(1)).
     4735 +
     4736 +
4335 4737         -R filename
4336 4738                        The -R filename option is used to generate a cross
4337 4739                        reference database that can be used by a separate
4338 4740                        utility to find definitions and references for variables
4339 4741                        and commands.
4340 4742  
4341 4743  
4342 4744         -r
4343 4745                        If the -r option is present, the shell is a restricted
4344 4746                        shell.
↓ open down ↓ 130 lines elided ↑ open up ↑
4475 4877         +--------------------+-----------------+
4476 4878         |Interface Stability | See below.      |
4477 4879         +--------------------+-----------------+
4478 4880  
4479 4881  
4480 4882         The scripting interface is Uncommitted. The environment variables,
4481 4883         .paths feature, and editing modes are Volatile.
4482 4884  
4483 4885  SEE ALSO
4484 4886         cat(1), cd(1), chmod(1), cut(1), date(1), egrep(1), echo(1), egrep(1),
4485      -       env(1), fgrep(1), grep(1), login(1), newgrp(1), paste(1), printf(1),
4486      -       stty(1), test(1), umask(1), vi(1), dup(2), exec(2), fork(2), ioctl(2),
4487      -       lseek(2), pathconf(2), pipe(2), sysconf(3C), ulimit(2), umask(2),
4488      -       rand(3C), tcgetattr(3C), wait(3C), a.out(4), profile(4), attributes(5),
4489      -       environ(5), largefile(5), standards(5)
     4887 +       env(1), fgrep(1), grep(1), login(1), newgrp(1), paste(1), pfexec(1),
     4888 +       printf(1), stty(1), test(1), umask(1), vi(1), dup(2), exec(2), fork(2),
     4889 +       ioctl(2), lseek(2), pathconf(2), pipe(2), sysconf(3C), ulimit(2),
     4890 +       umask(2), rand(3C), tcgetattr(3C), wait(3C), a.out(4), profile(4),
     4891 +       attributes(5), environ(5), largefile(5), standards(5)
4490 4892  
4491 4893  
4492 4894         Bolsky, Morris I. and Korn, David G., The New KornShell Command and
4493 4895         Programming Language, Prentice Hall, 1995.
4494 4896  
4495 4897  
4496 4898         POSIX-Part 2: Shell and Utilities, IEEE Std 1003.2-1992, ISO/IEC
4497 4899         9945-2, IEEE, 1993.
4498 4900  
4499 4901  NOTES
↓ open down ↓ 34 lines elided ↑ open up ↑
4534 4936  
4535 4937         There might be some restrictions on creating a .paths file which is
4536 4938         portable across other operating systems.
4537 4939  
4538 4940  
4539 4941         If the system supports the 64-bit instruction set, /bin/ksh93 executes
4540 4942         the 64-bit version of ksh93.
4541 4943  
4542 4944  
4543 4945  
4544      -                                 June 27, 2018                        KSH93(1)
     4946 +                                January 6, 2020                       KSH93(1)
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX