1*b30d1939SAndy Fiddaman
2*b30d1939SAndy Fiddaman		KSH-93 VS. KSH-88
3*b30d1939SAndy Fiddaman
4*b30d1939SAndy Fiddaman
5*b30d1939SAndy FiddamanThe following is a list of known incompatibilities between ksh-93 and ksh-88.
6*b30d1939SAndy FiddamanI have not include cases that are clearly bugs in ksh-88.  I also have
7*b30d1939SAndy Fiddamanomitted features that are completely upward compatible.
8*b30d1939SAndy Fiddaman
9*b30d1939SAndy Fiddaman1.	Functions, defined with name() with ksh-93 are compatible with
10*b30d1939SAndy Fiddaman	the POSIX standard, not with ksh-88.  No local variables are
11*b30d1939SAndy Fiddaman	permitted, and there is no separate scope.  Functions defined
12*b30d1939SAndy Fiddaman	with the function name syntax, maintain compatibility.
13*b30d1939SAndy Fiddaman	This also affects function traces.
14*b30d1939SAndy Fiddaman
15*b30d1939SAndy Fiddaman2.	! is now a reserved word.  As a result, any command by that
16*b30d1939SAndy Fiddaman	name will no longer work with ksh-93.
17*b30d1939SAndy Fiddaman
18*b30d1939SAndy Fiddaman3.	The -x attribute of alias and typeset -f is no longer
19*b30d1939SAndy Fiddaman	effective and the ENV file is only read for interactive
20*b30d1939SAndy Fiddaman	shells.  You need to use FPATH to make function definitions
21*b30d1939SAndy Fiddaman	visible to scripts.
22*b30d1939SAndy Fiddaman
23*b30d1939SAndy Fiddaman4.	A built-in command named command has been added which is
24*b30d1939SAndy Fiddaman	always found before the PATH search.  Any script which uses
25*b30d1939SAndy Fiddaman	this name as the name of a command (or function) will not
26*b30d1939SAndy Fiddaman	be compatible.
27*b30d1939SAndy Fiddaman
28*b30d1939SAndy Fiddaman5.	The output format for some built-ins has changed.  In particular
29*b30d1939SAndy Fiddaman	the output format for set, typeset and alias now have single
30*b30d1939SAndy Fiddaman	quotes around values that have special characters.  The output
31*b30d1939SAndy Fiddaman	for trap without arguments has a format that can be used as input.
32*b30d1939SAndy Fiddaman
33*b30d1939SAndy Fiddaman6.	With ksh-88, a dollar sign ($') followed by a single quote was
34*b30d1939SAndy Fiddaman	interpreted literally.  Now it is an ANSI-C string.  You
35*b30d1939SAndy Fiddaman	must quote the dollar sign to get the previous behavior.
36*b30d1939SAndy Fiddaman	Also, a $ in front of a " indicates that the string needs
37*b30d1939SAndy Fiddaman	to be translated for locales other than C or POSIX.  The $
38*b30d1939SAndy Fiddaman	is ignored in the C and POSIX locale.
39*b30d1939SAndy Fiddaman
40*b30d1939SAndy Fiddaman7.	With ksh-88, tilde expansion did not take place inside ${...}.
41*b30d1939SAndy Fiddaman	with ksh-93, ${foo-~} will cause tilde expansion if foo is
42*b30d1939SAndy Fiddaman	not set.  You need to escape the ~ for the previous behavior.
43*b30d1939SAndy Fiddaman
44*b30d1939SAndy Fiddaman8.      Some changes in the tokenizing rules where made that might
45*b30d1939SAndy Fiddaman	cause some scripts with previously ambiguous use of quoting
46*b30d1939SAndy Fiddaman	to produce syntax errors.
47*b30d1939SAndy Fiddaman
48*b30d1939SAndy Fiddaman9.	Programs that rely on specific exit values for the shell,
49*b30d1939SAndy Fiddaman	(rather than 0 or non-zero) may not be compatible.  The
50*b30d1939SAndy Fiddaman	exit status for many shell failures has been changed.
51*b30d1939SAndy Fiddaman
52*b30d1939SAndy Fiddaman10.	Built-ins in ksh-88 were always executed before looking for
53*b30d1939SAndy Fiddaman	the command in the PATH variable.  This is no longer true.
54*b30d1939SAndy Fiddaman	Thus, with ksh-93, if you have the current directory first
55*b30d1939SAndy Fiddaman	in your PATH, and you have a program named test in your
56*b30d1939SAndy Fiddaman	directory, it will be executed when you type test; the
57*b30d1939SAndy Fiddaman	built-in version will be run at the point /bin is found
58*b30d1939SAndy Fiddaman	in your PATH.
59*b30d1939SAndy Fiddaman
60*b30d1939SAndy Fiddaman11.	Some undocumented combinations of argument passing to ksh
61*b30d1939SAndy Fiddaman	builtins no longer works since ksh-93 is getopts conforming
62*b30d1939SAndy Fiddaman	with respect to its built-ins.  For example, typeset -8i
63*b30d1939SAndy Fiddaman	previously would work as a synonym for typeset -i8.
64*b30d1939SAndy Fiddaman
65*b30d1939SAndy Fiddaman12.	Command substitution and arithmetic expansion are now performed
66*b30d1939SAndy Fiddaman	on PS1, PS3, and ENV when they are expanded.  Thus,  ` and $(
67*b30d1939SAndy Fiddaman	as part of the value of these variables must be preceded by a \
68*b30d1939SAndy Fiddaman	to preserve their previous behavior.
69*b30d1939SAndy Fiddaman
70*b30d1939SAndy Fiddaman13.	The ERRNO variable has been dropped.
71*b30d1939SAndy Fiddaman
72*b30d1939SAndy Fiddaman14.	If the file name following a redirection symbol contain pattern
73*b30d1939SAndy Fiddaman	characters they will only be expanded for interactive shells.
74*b30d1939SAndy Fiddaman
75*b30d1939SAndy Fiddaman15.	The arguments to a dot script will be restored when it completes.
76*b30d1939SAndy Fiddaman
77*b30d1939SAndy Fiddaman16.	The list of tracked aliases is not displayed with alias unless
78*b30d1939SAndy Fiddaman	the -t option is specified.
79*b30d1939SAndy Fiddaman
80*b30d1939SAndy Fiddaman17.	The POSIX standard requires that test "$arg" have exit status
81*b30d1939SAndy Fiddaman	of 0, if and only if $arg is null.  However, since this breaks
82*b30d1939SAndy Fiddaman	programs that use test -t, ksh-93 treats an explicit test -t
83*b30d1939SAndy Fiddaman	as if the user had entered test -t 1.
84*b30d1939SAndy Fiddaman
85*b30d1939SAndy Fiddaman18.	The ^T directive of emacs mode has been changed to work the
86*b30d1939SAndy Fiddaman	way it does in gnu-emacs.
87*b30d1939SAndy Fiddaman
88*b30d1939SAndy Fiddaman19.	ksh-88 allowed unbalanced parenthes within ${name op val} whereas
89*b30d1939SAndy Fiddaman	ksh-93 does not.  Thus, ${foo-(} needs to be written as ${foo-\(}
90*b30d1939SAndy Fiddaman	which works with both versions.
91*b30d1939SAndy Fiddaman
92*b30d1939SAndy Fiddaman20.     kill -l in ksh-93 lists only the signal names, not their numerical
93*b30d1939SAndy Fiddaman	values.
94*b30d1939SAndy Fiddaman
95*b30d1939SAndy Fiddaman21.	Local variables defined by typeset are statically scoped in
96*b30d1939SAndy Fiddaman	ksh-93.  In ksh-88 they were dynamically scoped although this
97*b30d1939SAndy Fiddaman	behavior was never documented.
98*b30d1939SAndy Fiddaman
99*b30d1939SAndy Fiddaman22.	The value of the variable given to getopts is set to ? when
100*b30d1939SAndy Fiddaman	the end-of-options is reached to conform to the POSIX standard.
101*b30d1939SAndy Fiddaman
102*b30d1939SAndy Fiddaman23.	Since the POSIX standard requires that octal constants be
103*b30d1939SAndy Fiddaman	recongnized, doing arithmetic on typeset -Z variables can
104*b30d1939SAndy Fiddaman	yield different results that with ksh-88.  Most of these
105*b30d1939SAndy Fiddaman	differences were eliminated in ksh-93o.  Starting in ksh-93u+, the
106*b30d1939SAndy Fiddaman	let command no longer recognizes octal constants starting with 0
107*b30d1939SAndy Fiddaman	for compatibility with ksh-88 unless the option letoctal is on.
108*b30d1939SAndy Fiddaman
109*b30d1939SAndy Fiddaman24.	Starting after ksh-93l, If you run ksh name, where name does
110*b30d1939SAndy Fiddaman	not contain a /, the current directory will be searched
111*b30d1939SAndy Fiddaman	before doing a path search on name as required by the POSIX
112*b30d1939SAndy Fiddaman	shell standard.
113*b30d1939SAndy Fiddaman
114*b30d1939SAndy Fiddaman25.	In ksh-93, cd - will output the directory that it changes
115*b30d1939SAndy Fiddaman	to on standard output as required by X/Open.  With ksh-88,
116*b30d1939SAndy Fiddaman	this only happened for interactive shells.
117*b30d1939SAndy Fiddaman
118*b30d1939SAndy Fiddaman26.	As an undocumented feature of ksh-88, a leading 0 to an
119*b30d1939SAndy Fiddaman	assignment of an integer variable caused that variable
120*b30d1939SAndy Fiddaman	to be treated as unsigned.  This behavior was removed
121*b30d1939SAndy Fiddaman	starting in ksh-93p.
122*b30d1939SAndy Fiddaman
123*b30d1939SAndy Fiddaman27.	The getopts builtin in ksh-93 requires that optstring contain
124*b30d1939SAndy Fiddaman	a leading + to allow options to begin with a +.
125*b30d1939SAndy Fiddaman
126*b30d1939SAndy Fiddaman28.	In emacs/gmacs mode, control-v will not display the version when
127*b30d1939SAndy Fiddaman	the stty lnext character is set to control-v or is unset.
128*b30d1939SAndy Fiddaman	The sequence escape control-v will display the shell version.
129*b30d1939SAndy Fiddaman
130*b30d1939SAndy Fiddaman29.	In ksh-88, DEBUG traps were executed. after each command.  In ksh-93
131*b30d1939SAndy Fiddaman	DEBUG traps are exeucted before each command.
132*b30d1939SAndy Fiddaman
133*b30d1939SAndy Fiddaman30.	In ksh-88, a redirection to a file name given by an empty string was
134*b30d1939SAndy Fiddaman	ignored.  In ksh-93, this is an error.
135*b30d1939SAndy FiddamanI am interested in expanding this list so please let me know if you
136*b30d1939SAndy Fiddamanuncover any others.
137