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