Differences between revisions 15 and 18 (spanning 3 versions)
Revision 15 as of 2011-10-08 19:05:02
Size: 3493
Editor: ormaaj
Comment: Rewrite. Add tables.
Revision 18 as of 2016-03-22 10:42:58
Size: 341
Editor: LaurenKell
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Korn Shell =
The KornShell is a reimplementation of the [[BourneShell|Bourne shell]]. It is downward compatible, but adds many features intended to simplify programming. Most of the features are part of [[PosixShell|POSIX shell]] too, and therefore are available on any POSIX compliant system. In the universe of shells it might be said that the Ksh family is Bash's closest relative. [[Bash]] implements much of the Korn shell's functionality and both share many common conventions. If care is taken it is possible to write polyglot code portable between these shells while still using a superset of POSIX sh features. For example, the (( arithmetic keyword. Incompatibilities do exist in many shared features. For instance, the Bash builtin '''read -a''' is equivalent to Ksh's '''read -A'''.

'''ksh88''', and it's successor '''ksh93''', is David Korn's "original" Korn shell. Now part of the ast-open package since being open-sourced by AT&T in 2000 under the CPL license, '''ksh93''' is still actively developed and is probably what someone is referring to if using the term "Ksh" without further qualification. It is also currently the most featureful. Additionally, there exist several variants under the name "Korn shell". Some of the most common and actively developed include ''mksh'' - the MirBSD Korn shell, and '''pdksh''' ("Public Domain Korn Shell") - intended to be ksh93's open-source replacement while it was still proprietary software.

The Korn shell (either ksh88 or ksh93, depending on the age of the system) is a standard part of any modern (commercial) Unix system, e.g. [[Solaris]], [[AIX]], [[HP-UX]]. pdksh is often available on BSD or GNU/Linux systems, and a growing number of GNU/Linux systems now offer ksh93, either instead of or in addition to pdksh.

Incomplete list of ksh93 features with no ''direct'' BashShell equivalent (as of version 4.2), (i.e., no same feature with same syntax by a different name). Some are trivial to accomplish in Bash by other means:

(Below is a work in progress)
||'''Feature'''||'''Description'''||
||{n1..n2[ ..n3]%fmt}||Sequence expression with a printf format specification applied to each generated argument.||
||{n[,m]}(pattern-list)||ERE-style arbitrary quantification of extended globs.||
||varname=([typeset [options]] assignment ...)||Compound and nested variable assignment. Similar to C structs. Bash arrays can only be homogenous datatypes.||
||%n$ and *n$||SUS printf extensions for addressing individual arguments||
||Floating point numeric types|| - ||
||print (built-in)||allows for reliably printing arbitrary characters.||

Incomplete list of BashShell features with no direct ksh93 equivalent:

||'''Feature'''||'''Description'''||
||;;&||case...esac delimiter, like ;&, but additionally only continue if the next pattern list matches||
||pushd/popd/dirs/~[+|-]N|| Ksh has no directory stack. Tilde expansion supports only one level.||

Other important notes:
 * Bash co-processes are considerably different and weren't available in Bash at all until version 4. (process |& versus the coproc keyword)
 * Ksh has always executed the last command of a pipeline in the parent shell's environment. Bash has always used a subshell for all pipeline commands. Bash 4.2 adds the '''lastpipe''' shopt option, but it isn't enabled by default.
 * $SECONDS in ksh93 has millisecond precision. Bash only counts seconds and has no high-resolution timestamp mechanism.

----
CategoryShell
59 yr old Building Inspector Grant Hanzely from La Ronge, loves grip strength, upstore premium link generator and sky diving. Identified some amazing spots after spending 7 weeks at Royal Hill of Ambohimanga.<<BR>><<BR>>
<<BR>><<BR>>
Here is my website ... [[https://www.wattpad.com/user/upstorepremiumlink|upstore.net account password]]

59 yr old Building Inspector Grant Hanzely from La Ronge, loves grip strength, upstore premium link generator and sky diving. Identified some amazing spots after spending 7 weeks at Royal Hill of Ambohimanga.



Here is my website ... upstore.net account password

KornShell (last edited 2022-06-20 20:47:27 by emanuele6)