Korn Shell: Difference between revisions

From Rosetta Code
Content added Content deleted
(Adding in an example version string for MKSH (on Arch Linux).)
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{implementation|UNIX Shell}}
{{implementation|UNIX Shell}}
'''Korn Shell''', or ''ksh'', is the creation of David Korn at AT&T. This shell combines [[derived from::compatible with::Bourne Shell]] syntax with a command-line editor, command history, tilde expansion, arithmetic expressions, arrays, coprocesses and several more features. Korn Shell has influenced many later shells; [[Public Domain Korn Shell]] and [[Z Shell]] clone several features, and the X/Open and POSIX standards take a few features from Korn Shell. David Korn continues to maintain [[ksh93]], the original implementation.
'''Korn Shell''', or ''ksh'', is the creation of David Korn at AT&T. This shell combines [[Bourne Shell]] syntax with a command-line editor, command history, tilde expansion, arithmetic expressions, arrays, co-processes and several more features. Korn Shell has influenced many later shells; [[Bourne Again SHell]] and [[Z Shell]] clone several features, and the X/Open and [[POSIX]] standards take a few features from Korn Shell. David Korn continues to maintain [[ksh93]], the original implementation.


AT&T freed ksh93 during 2000, using an open-source license. For many years before that, the original Korn Shell was not free; it was only part of AT&T System V and some commercial Unix variants. Therefore, ''ksh'' in some systems is not David Korn's shell, but is some other shell, perhaps ''pdksh'' or [[MirBSD Korn Shell|''mksh'']].
AT&T freed ksh93 during 2000, using an open-source license. For many years before that, the original Korn Shell was not free; it was only part of AT&T System V and some commercial Unix variants. Therefore, ''ksh'' in some systems is not David Korn's shell, but is some other shell, perhaps [[Public Domain Korn Shell|''pdksh'']] or [[MirBSD Korn Shell|''mksh'']].


== Which Korn Shell do I have? ==
== Which Korn Shell do I have? ==
Start ''ksh'' and run
Start ''ksh'' and run


<lang bash>$ echo $KSH_VERSION</lang>
<syntaxhighlight lang="ksh">$ echo $KSH_VERSION</syntaxhighlight>


* If the output looks like <code style="background: yellow;">Version JM 93u 2011-02-08</code>, then you have ''[[ksh93]]''.
* If the output looks like <code style="background: yellow;">Version JM 93u 2011-02-08</code>, then you have ''[[ksh93]]''.
** Version AJM 93u+ 2012-08-01
* If the output looks like <code style="background: yellow;">@(#)PD KSH v5.2.14 99/07/13.2</code>, then you have ''[[pdksh]]''.
* If the output looks like <code style="background: yellow;">@(#)PD KSH v5.2.14 99/07/13.2</code>, then you have ''[[pdksh]]''.
* If the output looks like <code style="background: yellow;">@(#)MIRBSD KSH R49 2014/01/11</code>, then you have ''[[mksh]]''.
* If the output looks like <code style="background: yellow;">@(#)MIRBSD KSH R49 2014/01/11</code>, then you have ''[[mksh]]''.

Latest revision as of 12:26, 22 August 2023

Korn Shell is an implementation of UNIX Shell. Other implementations of UNIX Shell.

Korn Shell, or ksh, is the creation of David Korn at AT&T. This shell combines Bourne Shell syntax with a command-line editor, command history, tilde expansion, arithmetic expressions, arrays, co-processes and several more features. Korn Shell has influenced many later shells; Bourne Again SHell and Z Shell clone several features, and the X/Open and POSIX standards take a few features from Korn Shell. David Korn continues to maintain ksh93, the original implementation.

AT&T freed ksh93 during 2000, using an open-source license. For many years before that, the original Korn Shell was not free; it was only part of AT&T System V and some commercial Unix variants. Therefore, ksh in some systems is not David Korn's shell, but is some other shell, perhaps pdksh or mksh.

Which Korn Shell do I have?

Start ksh and run

$ echo $KSH_VERSION
  • If the output looks like Version JM 93u 2011-02-08, then you have ksh93.
    • Version AJM 93u+ 2012-08-01
  • If the output looks like @(#)PD KSH v5.2.14 99/07/13.2, then you have pdksh.
  • If the output looks like @(#)MIRBSD KSH R49 2014/01/11, then you have mksh.
  • A zsh invoked as ksh sets ZSH_VERSION, not KSH_VERSION.

Links