One of the first major alternatives to the "traditional"
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.
Unlike bash , the Korn shell is a commercial product; the source code is not available and you have to purchase the executable (which is usually bundled with the other utilities on most commercial versions of UNIX).
The 1988 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).
· Coroutines are supported. Two processes can communicate with one another by using the print and read commands.
·
The command
print
· Function autoloading is supported. Functions are read into memory only when they are called.
· String conditional tests have a new syntax of the form [[...]] .
·
There is an additional "fake" signal, ERR. This signal is sent when a script or function exits with a
· One-dimensional arrays are supported, although they are limited to a maximum size of 1024 elements.
· Filename generation capabilities are substantially increased by expanding on pattern matching and including regular expression operators.
·
The history list is kept in a file rather than in memory. This allows concurrent
· There is no default startup file. If the environment variable ENV is not defined, nothing is read.
·
The
type
command is
· The primary prompt string ( PS1 ) doesn't allow escaped commands.
· There are no built-in equivalents to builtin , command , and 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.
· Brace expansion is not supported in the default configuration, but is a compile-time option.
· ! is not a keyword.
·
Prompt strings don't allow backslash-escaped special
· There is no provision for online help.
·
Many of the
bash
environment
|
BASH |
BASH_VERSION |
|
BASH_VERSINFO |
DIRSTACK |
|
EUID |
FIGNORE |
|
GLOBIGNORE |
HISTCMD |
|
HISTFILESIZE |
HISTIGNORE |
|
HISTCONTROL |
HOSTFILE |
|
HOSTNAME |
HOSTTYPE |
|
IGNOREEOF |
INPUTRC |
|
MACHTYPE |
OPTERR |
|
OSTYPE |
PROMPT_COMMAND |
|
PIPESTATUS |
SHELLOPTS |
|
SHLVL |
TIMEFORMAT |
|
UID |
auto_resume |
|
histchars |
|
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 1988 Korn shell, plus differences with the 1993 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 drawbacks are that it isn't