The Korn Shell

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.

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 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.

·                 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 non-zero status.

·                 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 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 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 characters .

·                 There is no provision for online help.

·                 Many of the bash environment variables don't exist, notably:

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 freely available and is upgraded only every few years .

 



Learning the Bash Shell
Learning the bash Shell: Unix Shell Programming (In a Nutshell (OReilly))
ISBN: 0596009658
EAN: 2147483647
Year: 1998
Pages: 104

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net