Korn shell
Encyclopedia
The Korn shell is a Unix shell
Unix shell
A Unix shell is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems...

 which was developed by David Korn (AT&T Bell Laboratories
Bell Labs
Bell Laboratories is the research and development subsidiary of the French-owned Alcatel-Lucent and previously of the American Telephone & Telegraph Company , half-owned through its Western Electric manufacturing subsidiary.Bell Laboratories operates its...

) in the early 1980s and announced at USENIX
USENIX Annual Technical Conference
The USENIX Annual Technical Conference is a conference of computing professions sponsored by the USENIX association. The conference includes computing tutorials, and a single track technical session for presenting refereed research papers, SIG meetings, and BoFs.There have been several notable...

 on July 14, 1983. Other early contributors were AT&T Bell Labs developers Mike Veach, who wrote the emacs
Emacs
Emacs is a class of text editors, usually characterized by their extensibility. GNU Emacs has over 1,000 commands. It also allows the user to combine these commands into macros to automate work.Development began in the mid-1970s and continues actively...

 code, and Pat Sullivan, who wrote the vi
Vi
vi is a screen-oriented text editor originally created for the Unix operating system. The portable subset of the behavior of vi and programs based on it, and the ex editor language supported within these programs, is described by the Single Unix Specification and POSIX.The original code for vi...

 code. ksh is backwards-compatible with the Bourne shell
Bourne shell
The Bourne shell, or sh, was the default Unix shell of Unix Version 7 and most Unix-like systems continue to have /bin/sh - which will be the Bourne shell, or a symbolic link or hard link to a compatible shell - even when more modern shells are used by most users.Developed by Stephen Bourne at AT&T...

 and includes many features of the C shell
C shell
The C shell is a Unix shell that was created by Bill Joy while a graduate student at University of California, Berkeley in the late 1970s. It has been distributed widely, beginning with the 2BSD release of the BSD Unix system that Joy began distributing in 1978...

 as well, such as a command history
Command History
Command history is a feature in many operating system shells, computer algebra programs, and other software that allows the user to recall, edit and rerun previous commands....

, which was inspired by the requests of Bell Labs users.

Design

The main advantage of ksh over the traditional Unix shell is in its use as a programming language. Since its conception, several features were gradually added, while maintaining strong backwards compatibility with the Bourne shell
Bourne shell
The Bourne shell, or sh, was the default Unix shell of Unix Version 7 and most Unix-like systems continue to have /bin/sh - which will be the Bourne shell, or a symbolic link or hard link to a compatible shell - even when more modern shells are used by most users.Developed by Stephen Bourne at AT&T...

.

The ksh93 version supports associative array
Associative array
In computer science, an associative array is an abstract data type composed of a collection of pairs, such that each possible key appears at most once in the collection....

s and built-in floating point arithmetic
Floating point
In computing, floating point describes a method of representing real numbers in a way that can support a wide range of values. Numbers are, in general, represented approximately to a fixed number of significant digits and scaled using an exponent. The base for the scaling is normally 2, 10 or 16...

.

For interactive use, ksh provides the ability to edit the command line in a WYSIWYG
WYSIWYG
WYSIWYG is an acronym for What You See Is What You Get. The term is used in computing to describe a system in which content displayed onscreen during editing appears in a form closely corresponding to its appearance when printed or displayed as a finished product...

 fashion, by hitting the appropriate cursor-up or previous-line key-sequence to recall a previous command, and then edit the command as if the users were in edit line mode. Three modes are available, compatible with vi
Vi
vi is a screen-oriented text editor originally created for the Unix operating system. The portable subset of the behavior of vi and programs based on it, and the ex editor language supported within these programs, is described by the Single Unix Specification and POSIX.The original code for vi...

, emacs
Emacs
Emacs is a class of text editors, usually characterized by their extensibility. GNU Emacs has over 1,000 commands. It also allows the user to combine these commands into macros to automate work.Development began in the mid-1970s and continues actively...

and XEmacs
XEmacs
XEmacs is a graphical- and console-based text editor which runs on almost any Unix-like operating system as well as Microsoft Windows. XEmacs is a fork, based on a version of GNU Emacs from the late 1980s...

.

ksh aims to respect the Shell Language Standard (POSIX
POSIX
POSIX , an acronym for "Portable Operating System Interface", is a family of standards specified by the IEEE for maintaining compatibility between operating systems...

 1003.2 "Shell and Utilities Language Committee").

History

Until 2000, Korn Shell remained AT&T's proprietary software
Proprietary software
Proprietary software is computer software licensed under exclusive legal right of the copyright holder. The licensee is given the right to use the software under certain conditions, while restricted from other uses, such as modification, further distribution, or reverse engineering.Complementary...

. Since then it has been open source software, originally under a license particular to AT&T but, since the 93q release in early 2005, it has been licensed under the Common Public License
Common Public License
In computing, the CPL is a free software / open-source software license published by IBM. The Free Software Foundation and Open Source Initiative have approved the license terms of the CPL....

. Korn Shell is available as part of the AT&T Software Technology (AST) Open Source Software Collection. As ksh was initially only available through a proprietary license from AT&T, a number of free and open source alternatives were created. These include the public domain pdksh and its actively developed successor mksh, the Free Software Foundation
Free Software Foundation
The Free Software Foundation is a non-profit corporation founded by Richard Stallman on 4 October 1985 to support the free software movement, a copyleft-based movement which aims to promote the universal freedom to create, distribute and modify computer software...

's Bourne-Again-Shell bash, and zsh.

The functionality of the original Korn Shell (known as ksh88 from the year of its introduction) was used as a basis for the POSIX
POSIX
POSIX , an acronym for "Portable Operating System Interface", is a family of standards specified by the IEEE for maintaining compatibility between operating systems...

 shell standard.

Although the ksh93 version added many improvements (associative array
Associative array
In computer science, an associative array is an abstract data type composed of a collection of pairs, such that each possible key appears at most once in the collection....

s, floating point arithmetic, etc.), some vendors still ship their own version of the older ksh88 as /bin/ksh, sometimes with extensions. ksh93 is still maintained by its author. Releases of ksh93 are versioned by appending a letter to the name; the current version is ksh93u (released 2011-02-08); the previous version was ksh93t+ (released 2009-05-01) following ksh93t (released 2008-06-24). Some intermediate bug-fix versions are released without changes to this version string.

As "Desktop KornShell", dtksh, the ksh93 was distributed as part of the Common Desktop Environment
Common Desktop Environment
The Common Desktop Environment is a desktop environment for Unix and OpenVMS, based on the Motif widget toolkit.- Corporate history :...

 with several Unix systems, including Solaris, AIX, and HP-UX
HP-UX
HP-UX is Hewlett-Packard's proprietary implementation of the Unix operating system, based on UNIX System V and first released in 1984...

. This version also provide shell-level mappings for Motif
Motif (widget toolkit)
In computing, Motif refers to both a graphical user interface specification and the widget toolkit for building applications that follow that specification under the X Window System on Unix and other POSIX-compliant systems. It emerged in the 1980s as Unix workstations were on the rise, as a...

 widgets. It was intended as competitor to tcl/tk.

Uses and variants

There are also two modified versions of ksh93 which add features for manipulating the graphical user interface
Graphical user interface
In computing, a graphical user interface is a type of user interface that allows users to interact with electronic devices with images rather than text commands. GUIs can be used in computers, hand-held devices such as MP3 players, portable media players or gaming devices, household appliances and...

: dtksh which is part of CDE
Common Desktop Environment
The Common Desktop Environment is a desktop environment for Unix and OpenVMS, based on the Motif widget toolkit.- Corporate history :...

 and tksh which provides access to the Tk widget toolkit
Widget toolkit
In computing, a widget toolkit, widget library, or GUI toolkit is a set of widgets for use in designing applications with graphical user interfaces...

.

mksh (MirBSD
MirOS BSD
MirOS BSD is a free and open source operating system, which started as a fork of OpenBSD 3.1 in August 2002. It is intended to maintain the security of OpenBSD - from which it frequently synchronises code updates - with better support for European localisation...

 Korn Shell
Ksh
KSH or ksh may refer to:*Kenyan shilling, the currency of Kenya*Korn shell, a Unix shell developed by David Korn in the early 1980s*Kölsch language , a Ripuarian dialect spoken in Germany, the Hungarian Central Statistical Office*Shahid Ashrafi Esfahani Airport , in Kermanshah, Iran...

) is an actively developed, BSDish-licensed
MirOS Licence
The MirOS Licence is a free content licence originated at The MirOS Project for their own publications because the ISC license used by OpenBSD was perceived as having problems with wording and too America centric...

, flavour of ksh. It is a direct descendant from the OpenBSD
OpenBSD
OpenBSD is a Unix-like computer operating system descended from Berkeley Software Distribution , a Unix derivative developed at the University of California, Berkeley. It was forked from NetBSD by project leader Theo de Raadt in late 1995...

's /bin/ksh and heir of pdksh. mksh development focuses on code portability, security fixes, UTF-8
UTF-8
UTF-8 is a multibyte character encoding for Unicode. Like UTF-16 and UTF-32, UTF-8 can represent every character in the Unicode character set. Unlike them, it is backward-compatible with ASCII and avoids the complications of endianness and byte order marks...

 support, and tries to avoid feature creep. It will, however, track POSIX closely and implement many ksh93 and some bash or zsh extensions. It is available for many unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....

 operating systems and is a default shell of MirOS BSD
MirOS BSD
MirOS BSD is a free and open source operating system, which started as a fork of OpenBSD 3.1 in August 2002. It is intended to maintain the security of OpenBSD - from which it frequently synchronises code updates - with better support for European localisation...

, FreeWRT, MidnightBSD
MidnightBSD
MidnightBSD is a free Unix-like, desktop-oriented operating system based on FreeBSD 6.1. It borrows heavily from the NEXTSTEP graphical user interface.- History and development :...

, Android-x86, Android 3.0 (Honeycomb) and possibly the not-yet-released Android 4 (Ice Cream).

oksh is a port of OpenBSD
OpenBSD
OpenBSD is a Unix-like computer operating system descended from Berkeley Software Distribution , a Unix derivative developed at the University of California, Berkeley. It was forked from NetBSD by project leader Theo de Raadt in late 1995...

's /bin/ksh to GNU/Linux which only contains enough modifications so that the code can compile
under a GNU/Linux system. It is used as the default shell in DeLi Linux.

SKsh is an AmigaOS
AmigaOS
AmigaOS is the default native operating system of the Amiga personal computer. It was developed first by Commodore International, and initially introduced in 1985 with the Amiga 1000...

 version, that offers several Amiga-specific features such as ARexx
ARexx
ARexx is an implementation of the REXX language for the Amiga, written in 1987 by William S. Hawes, with a number of Amiga-specific features beyond standard REXX facilities. Like most REXX implementations, ARexx is an interpreted language...

 interoperability.

MKS Inc.'s MKS Korn shell is another proprietary ksh reimplementation. It was included with Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

's Services for Unix
Microsoft Windows Services for UNIX
Windows Services for UNIX or Subsystem for UNIX-based Applications is a software package produced by Microsoft which provides a Unix subsystem and other parts of a full Unix environment on Windows NT and some of its immediate successor operating-systems...

 (SFU) up to version 2.0. According to David Korn, the MKS Korn shell was not fully compatible with his own Korn shell implementation in 1998.

With the introduction of SFU
Microsoft Windows Services for UNIX
Windows Services for UNIX or Subsystem for UNIX-based Applications is a software package produced by Microsoft which provides a Unix subsystem and other parts of a full Unix environment on Windows NT and some of its immediate successor operating-systems...

 Version 3.0, Microsoft has replaced the MKS Korn shell with a new and fully POSIX compliant Korn shell as part of the new native Interix
Interix
Interix is the name of an optional, full-featured POSIX and Unix environment subsystem for Microsoft's Windows NT-based operating systems.Interix is a component of the Services for Unix release 3.0 and 3.5...

 subsystem technology. It is supported on Windows NT 4.0
Windows NT 4.0
Windows NT 4.0 is a preemptive, graphical and business-oriented operating system designed to work with either uniprocessor or symmetric multi-processor computers. It was the next release of Microsoft's Windows NT line of operating systems and was released to manufacturing on 31 July 1996...

 SP6a+, Windows 2000
Windows 2000
Windows 2000 is a line of operating systems produced by Microsoft for use on personal computers, business desktops, laptops, and servers. Windows 2000 was released to manufacturing on 15 December 1999 and launched to retail on 17 February 2000. It is the successor to Windows NT 4.0, and is the...

, Windows XP
Windows XP
Windows XP is an operating system produced by Microsoft for use on personal computers, including home and business desktops, laptops and media centers. First released to computer manufacturers on August 24, 2001, it is the second most popular version of Windows, based on installed user base...

 Professional and Windows Server 2003
Windows Server 2003
Windows Server 2003 is a server operating system produced by Microsoft, introduced on 24 April 2003. An updated version, Windows Server 2003 R2, was released to manufacturing on 6 December 2005...

. It is also available in the Subsystem for UNIX-based Applications (SUA) of Windows Vista
Windows Vista
Windows Vista is an operating system released in several variations developed by Microsoft for use on personal computers, including home and business desktops, laptops, tablet PCs, and media center PCs...

 and 7
Windows Vista
Windows Vista is an operating system released in several variations developed by Microsoft for use on personal computers, including home and business desktops, laptops, tablet PCs, and media center PCs...

 Enterprise and Ultimate Editions only and Windows Server 2008. It is the default shell (/bin/sh) for SUA. The Korn shell is also included in UWIN
UWIN
UWIN is a computer software package created by David Korn which allows programs written for the operating system Unix be built and run on Microsoft Windows with few, if any, changes...

, a separate Unix compatibility package created by Korn himself; however, UWIN only explicitly support versions of Windows up to XP, included.

The original Korn shell (ksh88) is the default shell on AIX since AIX version 4. with ksh93 available separately.

Further reading

  • David G. Korn, Charles J. Northrup and Jeffery Korn The New KornShell—ksh93, Linux Journal
    Linux Journal
    Linux Journal is a monthly technology magazine published by Belltown Media, Inc. of Houston, Texas. The magazine focuses specifically on Linux, allowing the content to be a highly specialized source of information for open source enthusiasts.-History:...

    , Issue 27, July 1996

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK