RELEASE88 revision da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThis is a list of changes that have been made since the 11/16/88 version
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinof ksh.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin1. New features in 12/28/93
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin a. Associative arrays. The new version of ksh supports both
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin associate arrays and the older indexed arrays with the same
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin array syntax. A new -A option of typeset is used to declare
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin an array to be associative. As with indexed arrays, $name is
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin equivalent to ${name[0]}. The prefix operator ! was added
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin to the parameter expansion syntax to expand to the list of
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin indices. For example, ${!name[@]} expands to the list of array
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin indices for variable name.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin b. Several additions have been made to shell arithmetic:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. The shell now performs floating point arithmetic. The
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin typeset options -F and -E have been added for floating
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin point and scientific notation respectively.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. The prefix and postfix ++ and -- operators.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 3. The comma and ?: operators.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 4. The math library functions.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 5. An arithmetic for statement of the form
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for ((expr1; expr2; expr3))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin do ...
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin done
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 6. Integer arithmetic extended up to base 64.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin c. Some additions to the macro expansion syntax have been made
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin to specify substrings and sub-arrays:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. ${name:expr} expands to the substring of ${name} starting at
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the character position defined by arithmetic expression expr.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. ${name:expr1:expr2} expands to the substring of ${name} starting
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin at expr1 and consisting of at most expr2 characters.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 3. ${name[@]:expr} expands to the values of ${name[@]} starting at
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the element defined by arithmetic expression expr.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 4. ${name[@]:expr1:expr2} expands to at most expr2 values of
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin ${name} starting at expr1.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 5. ${@:expr} expands the positional parameters starting at expr.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 6. ${@:expr1:expr2} expands to at most expr2 positional parameters
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin starting at expr1.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 7. ${!name} expands to the name of the variable named by name.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin It will expand to name unless name is reference variable.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 8. ${!name[sub]} expands to the name of the subscript of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin given variable. If sub is @ or * the list of subscripts
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin is generated.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 9. ${!prefix*} and ${!prefix@} expand to the list of variable
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin names beginning with prefix.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 10. The substring operators, # and % can be now be applied
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin with aggregates (@ or *) and are applied to each.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 11. ${name/pattern/string} expands to the value of name with
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the first occurrence of pattern replaced by string.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin With aggregates (@ or *) this operation is applied to each.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 12. ${name/#pattern/string} Same as above but the pattern
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin to be replaced must match at the beginning.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 13. ${name/%pattern/string} Same as above but the pattern
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin to be replaced must match at the end.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 14. ${name//pattern/string} expands to the value of name with
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the each occurrence of pattern replaced by string.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin With aggregates (@ or *) this operation is applied to each.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin d. The name space for variables has been extended. The character '.'
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin can be used at the beginning of a name, and to separate identifiers
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin within a name. However, to create a name of the form, foo.bar,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the variable foo must exist. The namespace starting with .sh
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin is reserved for shell implementation variables. Exported
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin variable cannot contain a '.'.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin e. Compound assignments. The assignment syntax, varname=value,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin has been extended to allow assignments of the form
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin varname=(assignment_list). As elsewhere in the shell
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin spaces or tabs are optional around the parentheses, and
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin no space is permitted between the varname and the =. The
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin assignment_list can be one of the following:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. A list of words. In this case each word is expanded as
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin in a for list and the resulting items become elements
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin of the indexed array varname.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. A list of subscript assignments in the form
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin [subscript]=value. In this, these elements become
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin elements of the associative array varname.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 3. A list of assignments; simple or compound. In this
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin case, each assignment is made to varname.name, where
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin name is the name of the enclosed assignment.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 4. Assignments in the form of readonly or typeset
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin statements. In this case each assignment is made as
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin in 3 above, and the attributes are given to the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin corresponding variable.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin In case 3 and 4 above, the value of "$varname" after
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the above assignment is (assignment_list), where the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin assignment_list produced would reproduce all of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin variables under varname.*.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin f. Function names of the form variable.action (called discipline
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin functions) can be defined where variable is any valid variable
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin name and action is get, set, or unset. The function variable.get
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin is invoked each time the variable is referenced. The set
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin discipline is invoked each time the variable is assigned to.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin The unset discipline is invoked when a variable is unset.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin The new variables .sh.name, .sh.subscript, and .sh.value are
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin defined inside the function body. Other shell extensions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin may have their own set of discipline functions.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin g. The compound command !, which negates the return value of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin following pipeline, has been added.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin h. On systems that support dynamic loading with dlopen(), it is
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin now possible to add built-in commands at runtime with the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin a builtin command named builtin.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin i. The following builtins have been added:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. command name [ ... ]
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. sleep [decimal-seconds]
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 3. builtin [-ds] [-f file] [name...]
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 4. getconf name [pathname]
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 5. disown [job...]
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin j. An addition format for literal strings, $'....' can
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin be used where ever literal strings are valid. The string
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin inside the single quotes will be converted using the ANSI-C
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin escape conventions. Additionally, the escape sequence \E
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expands to the escape character (default \033) whenever ANSI-C
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin escape sequences are recognized.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin k. A typeset -n option has been added which causes the value of a
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin variable to be treated as a reference to another variable so that
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin variables can be indirectly named. For example, if $1 contains
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the name of a variable, then typeset -n foo=$1 causes the variable
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin foo to be synonymous with the variable whose name is $1. A builtin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin alias, nameref='typeset -n' has been added to aid mnemonics.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Reference names cannot contain a '.'. Whenever that portion of
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin a variable up to the first '.' matches a reference name, the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin reference value is substituted. For example, with nameref foo=.top,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin then ${foo.bar} is equivalent to ${.top.bar}. When used as the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin index of a for or select loop, each assignment causes a
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin new name reference to occur.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin l. The KEYBD trap has been added which is triggered when a key
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin or escape sequence is typed while reading from the keyboard
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin in an edit mode. This, combined with some new variables
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin makes it possible to program your key bindings in ksh.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin m. New variables have been added:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. FIGNORE defines a set of file names to be ignored in each
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin directory when performing pathname expansion, replacing
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the rule that requires that a leading . be matched explicitly.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. Variable sh.edchar contains the value of the keyboard character
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin that has been entered when processing a KEYBD trap. If the value
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin is changed as part of the trap action, then the new value replaces
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the key or keys that caused the trap.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 3. Variable sh.edcol is set to the character position of the cursor
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin within the input buffer during a KEYBD trap.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 4. Variable sh.edmode is set to the escape character when in vi
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin insert mode.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 5. Variable sh.edtext is set to the contents of the input buffer
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin during a KEYBD trap.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 6. HISTEDIT is checked before FCEDIT. FCEDIT is obsolete.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 7. HISTCMD is the number of the current command in the history
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin file.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 8. Variable .sh.version is set to the version string for
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin this shell.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 9. Variable .sh.name is set to the name of the variable
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin that that was referenced or assigned to when executing a get
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin or set discipline function.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 10. Variable .sh.subscript is set to the subscript for the variable
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin that was referenced or assign to when executing a get or
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin set discipline function.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 11. Variable .sh.value is set to the new value for the variable
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin that was assigned to when executing the set discipline function.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin n. New invocation and set -o options have been added:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. set -o notify (or set -b) causes background completion messages
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin to be displayed as soon as the job completes.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. There is a compile time option named KIA which enables
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin creation of a relational database for commands, variables
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin and functions defined and referenced by a script. The
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin option -I <filename>, causes the database to be generated
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin in <filename>. The database format can be queried via
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the cql command.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin o. ksh93 can read and evaluate pre-compiled scripts generated by
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin a separate program called shcomp.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin p. More work on internationalization has been added:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. The decimal point character is processed per locale
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. A $ can be placed in front of each string to indicate
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin that the string needs translation but is otherwise ignored.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin This means that if a message catalog of all $"..." strings
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin is generated, then a program such as print $"hello world"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin could display "bonjour monde" in the french locale.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin q. Backreferences have been added to pattern matching. The sequence
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin \d, where d is a digit from 1-9, matches the same string as
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the d-th previous parenthesis group. Backreferences
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin can be used within patterns, and within replacement strings
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin with any of the ${name/...} operators.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin2. Changes made in 12/28/93
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin a. The output format of many commands has changed as follows:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. System error messages are displayed whenever a failure
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin is caused by a system call.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. The exit status has changed in many cases:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin a. USAGE messages cause an exit status of 2.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin b. Commands not found cause exit - 127.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin c. Command found, but not executable - 126.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin d. Terminated because of signal - 256+sig
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 3. The output of values from built-ins that contain special
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin characters are quoted in a manner that then can be re-input.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 4. The trace output puts quotes around the output so that it
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin can be reused as input.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 5. The output for trap is in a format that can be reinput the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the shell to restore the traps.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 6. kill -l lists the signal names without numbers as
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin required by the POSIX standard.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin b. The following changes have been made to shell functions:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. The semantics of functions declared with name() has changed
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin to conform with the IEEE-POSIX 1003.2 standard. In particular,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin these functions are executed in a dot script environment rather
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin than a separated function environment so that there are no
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin local variables and no scoping for traps.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. Functions declared as function name, preserve the old ksh
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin semantics can be also used as the first argument to the dot (.)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin command to have them executed in a dot script environment.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin c. The command search rules have changed as follows:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. Special built-ins (those with a dagger in front of them) are
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin executed first.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. Functions are executed next.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 3. Other built-ins that do not require an executable version
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin (for example cd and read) come next.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 4. If the command name contains a slash, the pathname corresponding
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin to the command name is executed.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 5. If name corresponds to a previously encountered pathname
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin on the PATH variable, the corresponding command is executed.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 6. If the command name does not contain a slash, then the PATH
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin variable is used to find an executable by that name. If
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the directory that the command is found is also contained in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the FPATH variable, then the command treated as a function.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin If the shell has a built-in version of the command corresponding
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin to this command, then the built-in version of this command
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin is executed. Otherwise, the shell remembers that pathname
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin corresponding to this command name and executes this pathname.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 7. If the name is not found on PATH, then the directories in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin FPATH are searched. If found, then the command is executed
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin as a function.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin d. Built-in commands options now conform to the IEEE-POSIX 1003.2
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin conventions with some additions. In particular,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin name -?
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin will now print a Usage line for name, except for true, false,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin colon, login, newgrp, echo, [, and command.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin e. Tilde expansion is now performed as part of the word expansions.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin The effect of this is that if word begins with ~ in ${name op word},
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin it will be expanded unless escaped.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin f. Pathname expansion is no longer performed on redirection words
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin unless the shell is interactive.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin g. Changes to shell and options:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. The -n option has been enhanced to produce more warning and
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin portability messages.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. The -C option is equivalent to -o noclobber. Files are
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin created with O_EXCL when -C is on.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin h. The following changes have been made to [[...]]:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. A string by itself is equivalent to -n string.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. -e has been added as equivalent to -a.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 3. == has been added as equivalent =.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 4. -a and = are now considered obsolete.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 5. Arithmetic comparisons are now considered obsolete.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin i. kill has been changed as follows:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. Signal names can be upper case or lower case.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. Numerical arguments to kill -l cause the given signal names to
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin be displayed.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 3. String arguments to kill -l cause the given signal numbers to
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin be displayed.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 4. Synopsis changed for getopts conformance.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin j. print has a -f format option which is equivalent to
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the IEEE POSIX printf. Both print -f format, and
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin printf have the following extensions from IEEE POSIX:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. Floating point formats are supported.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. Size and precision specifications can be *.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 3. The %d option can take an argument after precision to
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin specify the base that the number will be displayed.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 4. A %q format can be used to output a string quoted so
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin that it can be re-input to the shell.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 5. A %P format can be used to output the shell pattern which
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin corresponds to the give extended regular expression.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 6. For numerical fields, the arguments can be arithmetic
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expressions which will be evaluated.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 7. The %n format works as described in ANSI-C.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin k. The following changes have been made to fc:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. It has been renamed hist. fc is now a predefined alias.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. hist uses ${HISTEDIT:-$FCEDIT}. FCEDIT is obsolete.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 3. A new -s option is equivalent to the obsolete -e -.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 4. If the first argument refers to a command earlier than the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin first accessible command, it now implies the first accessible
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin command, so that hist -l 1 lists all accessible history commands.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin l. The dot command (.) has changed as follows:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. The argument can be the name of a function declared as
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin function name. The function will execute without creating a
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin new scope.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. If there are arguments to the given script or function,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the positional parameters are restored to their original
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin value when . completes.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin m. The read built-in has been changed as follows:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. A -A option to read has been added to allow the fields to be
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin read into an indexed array.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. A -t n option has been added which causes read to
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin timeout after n seconds when reading from a slow device.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 3. A -d char option has been added which causes the read
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin to terminate at char rather than at new-line.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin n. The trap command has been changed as follows:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. Trap names can be either upper case or lower case.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. Trap -p cause only the specified trap values to be displayed.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 3. The value of trap in a subshell will be the value in the parent
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin shell until a call to trap which changes the trap settings has
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin been made. Thus, savetraps=$(trap) works as required by the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin POSIX standard.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin o. The exec command has been extended as follows:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. The -c option clears the environment first.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. The -a name option sets argv[0] to name for the program.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin p. true and false are built-ins, not aliases to built-ins.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin q. test has been modified to conform to the IEEE-POSIX 1003.2
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin standard when there are three or less arguments.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin r. umask -S option displays the mask in a symbolic format.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin s. wait now returns the correct exit status of any previous
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin background job that has not been waited for, not just
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the most recent one.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin t. The whence built-in has an option -a which causes all
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin uses for the given command name to be reported.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin u. unalias has -a option to clear all the aliases.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin v. The times built-in command has been removed. The time
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin reserved word, without a command, gives time cumulative
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin time for the shell and its children. A built-in alias
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for times should enable scripts using times to continue
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin to run.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin w. Command substitution and arithmetic substitution will now be
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin performed for PS1, ENV, and PS4 evaluation in addition to
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin parameter expansion.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin x. The SECONDS variable now displays elapsed time in floating
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin point seconds with 3 places after the decimal point by
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin default.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin y. The getopts built-in now handles the complete libast optget
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin functionality. If any errors have occurred with getopts
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin when it has reached the end of arguments, then the Usage
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin message will be generated from the option string and the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin exit status from getopts will be 2 rather than 1. The
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin usage message will be stored in the OPTARG variable if
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the option string contains a leading colon; otherwise
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin it will be printed on standard error automatically.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin z. THE ENV file is only processed for interactive shell
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin invocations. In addition, the -x attributes for
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin aliases and functions is ignored.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin aa. The built-in edit modes have been changed as follows:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1. The pathname completion and pathname listing options
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin now perform command completion and command listing
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin when applied to a word in the command position.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 2. In emacs mode ^N as the first related command after
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the prompt will move to the next command relative to the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin last known history position.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 3. In emacs mode, successive kill and delete commands will
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin accumulate their data in the kill buffer, by appending or
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin prepending as appropriate. This mode will be reset by any
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin command not adding something to the kill buffer.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 4. The control-T of emacs mode has been changed to behave like
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin control-T in gnu-emacs.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin bb. The TMOUT variable also sets a limit for select timeouts
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin and default timeouts for read.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin4. The source code has undergone significant modification.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin a. Much of the code has been rewritten, In many cases this has
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin resulted in significant performance improvement.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin b. The code is organized differently. See the README files
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for more details.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin c. Most configuration parameters now get generated using
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the FEATURE mechanism of nmake. Other options are set
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin in the OPTIONS file.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin c. The are several new compile time options. See the README
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin file for details. Some of the old ones have been removed.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin d. The install script is a Mamfile that is generated by
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin nmake and processed by a script that comes with the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin distribution.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin e. There are far fewer global names. This should make it
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin must easier to add built-in commands without worrying
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin about conflicts.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin f. The code uses the sfio library which makes it possible
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin to mix with stdio.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin g. The code is written in ANSI C with full prototypes.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin The code is based on the IEEE POSIX 1003.1 standard.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin The code can be compiled with K&R C and with C++ by
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin using the ANSI cpp that comes with nmake or running
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the code through the proto filter before pre-processing.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin This happens automatically with our shipping system.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin h. There is a programming interface for capturing references
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin and assignment to shell variables. It is also possible
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin to intercept variable creation and supply the array processing
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin function for that variable. See nval.3 for a description.