COMPATIBILITY revision da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968
KSH-93 VS. KSH-88
The following is a list of known incompatibilities between ksh-93 and ksh-88.
I have not include cases that are clearly bugs in ksh-88. I also have
omitted features that are completely upward compatible.
1. Functions, defined with name() with ksh-93 are compatible with
the POSIX standard, not with ksh-88. No local variables are
permitted, and there is no separate scope. Functions defined
with the function name syntax, maintain compatibility.
This also affects function traces.
2. ! is now a reserved word. As a result, any command by that
name will no longer work with ksh-93.
3. The -x attribute of alias and typeset -f is no longer
effective and the ENV file is only read for interactive
shells. You need to use FPATH to make function definitions
visible to scripts.
4. A built-in command named command has been added which is
always found before the PATH search. Any script which uses
this name as the name of a command (or function) will not
be compatible.
5. The output format for some built-ins has changed. In particular
the output format for set, typeset and alias now have single
quotes around values that have special characters. The output
for trap without arguments has a format that can be used as input.
6. With ksh-88, a dollar sign ($') followed by a single quote was
interpreted literally. Now it is an ANSI-C string. You
must quote the dollar sign to get the previous behavior.
Also, a $ in front of a " indicates that the string needs
to be translated for locales other than C or POSIX. The $
is ignored in the C and POSIX locale.
7. With ksh-88, tilde expansion did not take place inside ${...}.
with ksh-93, ${foo-~} will cause tilde expansion if foo is
not set. You need to escape the ~ for the previous behavior.
8. Some changes in the tokenizing rules where made that might
cause some scripts with previously ambiguous use of quoting
to produce syntax errors.
9. Programs that rely on specific exit values for the shell,
(rather than 0 or non-zero) may not be compatible. The
exit status for many shell failures has been changed.
10. Built-ins in ksh-88 were always executed before looking for
the command in the PATH variable. This is no longer true.
Thus, with ksh-93, if you have the current directory first
in your PATH, and you have a program named test in your
directory, it will be executed when you type test; the
built-in version will be run at the point /bin is found
in your PATH.
11. Some undocumented combinations of argument passing to ksh
builtins no longer works since ksh-93 is getopts conforming
with respect to its built-ins. For example, typeset -8i
previously would work as a synonym for typeset -i8.
12. Command substitution and arithmetic expansion are now performed
on PS1, PS3, and ENV when they are expanded. Thus, ` and $(
as part of the value of these variables must be preceded by a \
to preserve their previous behavior.
13. The ERRNO variable has been dropped.
14. If the file name following a redirection symbol contain pattern
characters they will only be expanded for interactive shells.
15. The arguments to a dot script will be restored when it completes.
16. The list of tracked aliases is not displayed with alias unless
the -t option is specified.
17. The POSIX standard requires that test "$arg" have exit status
of 0, if and only if $arg is null. However, since this breaks
programs that use test -t, ksh93 treats an explicit test -t
as if the user had entered test -t 1.
18. The ^T directive of emacs mode has been changed to work the
way it does in gnu-emacs.
19. ksh-88 allowed unbalanced parenthes within ${name op val} whereas
ksh-93 does not. Thus, ${foo-(} needs to be written as ${foo-\(}
which works with both versions.
20. kill -l in ksh-93 lists only the signal names, not their numerical
values.
21. Local variables defined by typeset are statically scoped in
ksh93. In ksh88 they were dynamically scoped although this
behavior was never documented.
22. The value of the variable given to getopts is set to ? when
the end-of-options is reached to conform to the POSIX standard.
23. Since the POSIX standard requires that octal constants be
recongnized, doing arithmetic on typeset -Z variables can
yield different results that with ksh88. Most of these
differences were eliminated in ksh93o.
24. Starting after ksh93l, If you run ksh name, where name does
not contain a /, the current directory will be searched
before doing a path search on name as required by the POSIX
shell standard.
25. In ksh93, cd - will output the directory that it changes
to on standard output as required by X/Open. With ksh88,
this only happened for interactive shells.
26. As an undocumented feature of ksh-88, a leading 0 to an
assignment of an integer variable caused that variable
to be treated as unsigned. This behavior was removed
starting in ksh93p.
27. The getopts builtin in ksh93 requires that optstring contain
a leading + to allow options to begin with a +.
28. In emacs/gmacs mode, control-v will not display the version when
the stty lnext character is set to control-v or is unset.
The sequence escape control-v will display the shell version.
I am interested in expanding this list so please let me know if you
uncover any others.