A.3. The Korn Shell
One of the first major alternatives to
the "traditional" shells, Bourne
and C, was the Korn shell, publicly released in 1986 as part of
AT&T's "Experimental
Toolchest." The Korn shell was written by David Korn
at AT&T. The first version was unsupported, but eventually UNIX
System Laboratories (USL) decided to give it support when they
released it with their version of UNIX (System V Release 4) in 1989.
The November 1988 Korn shell is the most widely used version of this
shell.
The 1988 release is not fully POSIX-compliant—less so than
bash. The latest release (1993) has brought the
Korn shell into better compliance as well as providing more features
and streamlining existing features.
The 1993 Korn shell and bash share many
features, but there are some important differences in the Korn shell:
Functions are more like separate
entities than part of the invoking shell (traps and options are not
shared with the invoking shell).
Associative arrays are supported. Floating-point numbers and expressions are supported. Coroutines are
supported. Two processes can communicate with one another by using
the print and read commands.
The command print replaces echo. print
can have a file descriptor specified and can be used to communicate
with coroutines. Function autoloading is supported. Functions are read into memory
only when they are called.
One-dimensional
arrays are supported, although they are limited in size (4,096
elements in early versions of ksh93, 64K
elements in later releases). The history list is kept in a file rather than in memory. This allows
concurrent instantiations of the shell to access the same history
list, a possible advantage in certain circumstances.
There is no
default startup file. If the environment variable ENV is not defined, nothing is read. The type command is replaced with the more
restrictive whence. The primary prompt string (PS1)
doesn't allow escaped commands. There is no built-in equivalent to
enable. There is no provision for key bindings and no direct equivalent to
readline.
There are no built-in equivalents to
pushd, popd, and dirs. They have to be defined as functions if
you want them. The history substitution mechanism is not supported. Prompt strings don't allow backslash-escaped special
characters. Many of the bash environment variables don't exist.
In addition, the startup and environment files for Korn are
different, consisting of .profile and the file
specified by the ENV variable. The default environment file can
be overridden by using the variable ENV. There is no logout file.
For a more detailed list of the differences between
bash and the Korn shell see the
FAQ file in the doc
directory of the bash archive.
The Korn shell is a good alternative to bash.
Its only major drawback is that it is upgraded only every few years.
|