COMPATIBILITY revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe KSH-93 VS. KSH-88
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipeThe following is a list of known incompatibilities between ksh-93 and ksh-88.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipeI have not include cases that are clearly bugs in ksh-88. I also have
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipeomitted features that are completely upward compatible.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe1. Functions, defined with name() with ksh-93 are compatible with
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac the POSIX standard, not with ksh-88. No local variables are
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac permitted, and there is no separate scope. Functions defined
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe with the function name syntax, maintain compatibility.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe This also affects function traces.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe2. ! is now a reserved word. As a result, any command by that
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac name will no longer work with ksh-93.
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac3. The -x attribute of alias and typeset -f is no longer
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac effective and the ENV file is only read for interactive
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe shells. You need to use FPATH to make function definitions
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe visible to scripts.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe4. A built-in command named command has been added which is
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe always found before the PATH search. Any script which uses
a3d3ab94806056d2355afea6fe8daac41059b9fbludovicp this name as the name of a command (or function) will not
0f8553e2af5fc49a510ecfcfc93e66d06713f631ludo be compatible.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe5. The output format for some built-ins has changed. In particular
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe the output format for set, typeset and alias now have single
0f8553e2af5fc49a510ecfcfc93e66d06713f631ludo quotes around values that have special characters. The output
0f8553e2af5fc49a510ecfcfc93e66d06713f631ludo for trap without arguments has a format that can be used as input.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara6. With ksh-88, a dollar sign ($') followed by a single quote was
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara interpreted literally. Now it is an ANSI-C string. You
266c5071a91fda6a5159b08ea8d45261228d03d5neil_a_wilson must quote the dollar sign to get the previous behavior.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe Also, a $ in front of a " indicates that the string needs
9da44d3de0a7180285a77b7e8d2426a72aca249ejvergara 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, ksh-93 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
ksh-93. In ksh-88 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 ksh-88. Most of these
differences were eliminated in ksh-93o. Starting in ksh-93u+, the
let command no longer recognizes octal constants starting with 0
for compatibility with ksh-88 unless the option letoctal is on.
24. Starting after ksh-93l, 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 ksh-93, cd - will output the directory that it changes
to on standard output as required by X/Open. With ksh-88,
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 ksh-93p.
27. The getopts builtin in ksh-93 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.
29. In ksh-88, DEBUG traps were executed. after each command. In ksh-93
DEBUG traps are exeucted before each command.
30. In ksh-88, a redirection to a file name given by an empty string was
ignored. In ksh-93, this is an error.
I am interested in expanding this list so please let me know if you
uncover any others.