## A.2. The 1988 Korn Shell

Perhaps the most obvious shell with which to compare ksh93 is ksh88, the 1988 version of the Korn shell. This section briefly describes those features of ksh93 that are either different or nonexistent in ksh88. As with the presentation for the Bourne shell, the topics are covered in the same order as they're presented in the rest of the book.

Chapter 1
  The built-in help facilities (such as -?, --man, and so on) are not available.

  Tilde substitution does not occur during variable expansion (`${```var`` ``op`` `word``}`).

Chapter 2
  CTRL-T works differently in emacs editing mode. In ksh88, it transposes the two characters to the right of point and moves point forward by one character.

  In emacs-mode, ESC ESC, ESC `*`, and ESC `=` don't work on the first word of a command line, i.e., there is no command completion facility. The ESC `#` command always prepends a `#` character. It never removes them.

  Similarly, in vi-mode, the `*`, `\` and `=` commands don't work on the first word of a command line, and the `#` command always prepends a `#` character. It never removes them.

  Finally, there is no variable completion, the hist command is called fc, `FCEDIT` is used in place of `HISTEDIT`, and the `HISTCMD` variable is not available.

Chapter 3
  The `ENV` file is sourced for all shells, and ksh88 only does variable substitution on the value of `$ENV`.

  Alias tracking can be turned off in ksh88.

  The -p option to alias is not present in ksh88, nor is the -a option to unalias.

  The following built-in variables aren't supported:

  `.sh.edchar` | `.sh.match` | `.sh.version` | `LANG`
  `.sh.edcol` | `.sh.name` | `FIGNORE` | `LC_ALL`
  `.sh.edmode` | `.sh.subscript` | `HISTCMD` | `LC_COLLATE`
  `.sh.edtext` | `.sh.value` | `HISTEDIT` | `LC_CTYPE`

Chapter 4
  In ksh88, both syntaxes for defining functions produce functions with Korn shell semantics. You cannot apply the dot command to a function name.

  The command search order in ksh88 is keywords, aliases, all built-in commands, functions, and then external commands and scripts. The order was changed in ksh93 for POSIX compliance.

  In ksh88, undefined (autoloaded) functions are searched for exclusively along the list in the `FPATH` variable, and `PATH` is not involved.

  The .paths file feature is not available.

  Many of the variable substitution features described in the main text are new to ksh93. Only the following are available in ksh88: `${``name``:-`string`}`, `${``name``:=`string`}`, `${``name``:?`string`}`, `${``name``:+`string`}`, `${``name``#`pattern`}`, `${``name``##`pattern`}`, `${``name``%`pattern`}`, `${``name``%%`pattern`}`, $`{#``name``}`, $`{#``name``[*]}`, and $`{#``name``[@]}`.

  Compound variables, namerefs and the `+=` operator for appending to a variable are not in ksh88.

  The \n notation in patterns is not available, nor are non-greedy matching, the use of backslash escapes in patterns, options in subpatterns, nor any of the `[:`...`:]` character classes.

  The `.sh.match` array is not available.

Chapter 5
  Exit values in ksh88 only go up to 128. Programs that die due to a signal have exit status 128 plus signal number.

  There is no command built-in command. To replace a built-in, you have to use an awkward combination of aliasing, functions, and quoting.

  The set -o pipefail option and the the `!` keyword for reversing the sense of a test are not available. Instead of the `==` operator for `[[`...`]]`, ksh88 uses `=`.

  The arithmetic `for` loop is not in ksh88. The use of `;&` for falling through cases existed in ksh88 but was undocumented. The `TMOUT` variable existed in ksh88, but it only applied to the shell itself, not to the select loop or the read command.

Chapter 6
  The ksh88 getopts did not have the ability to specify numeric arguments to options, nor a way to specify optional arguments to options.

  The built-in arithmetic only supports integers, and the `++`, `--`, `?:` and comma operators aren't available. Numeric constants of the form `base``#`number can only go up to base 36. There are no built-in arithmetic functions.

  Only indexed arrays exist, and the maximum index is 1023.

Chapter 7
  The following I/O redirectors are not supported:

  `<&```n```-` | `>&```n```-` | `<<<`

  TCP/IP networking is available starting with ksh88e, but you must use IP addresses.

  ksh88 does not have the printf command, nor the -A, -d, -n, and -t options to read. `TMOUT` does not affect read.

  Brace expansion and process substitution are compile-time options that are generally not available in ksh88.

  Locale translation with `$"`...`"` and ANSI C strings with `$'`...`'` are not available.

Chapter 8
  The disown command is not available, and neither are the -n and -s options to kill. kill -l can only be used by itself to list the available signals.

  true and false are predefined aliases instead of built-in commands.

  Functions and aliases are exported to shell subprocesses; this is not true of ksh93.

Chapter 9
  Traps for the DEBUG fake signal are executed after each command is executed, not before.

  Discipline functions are not available.

Chapter 10
  The umask command only works with octal masks.

  You cannot customize the built-in editors; the KEYBD fake signal does not exist.

Copyright © 2003 O'Reilly & Associates. All rights reserved.