[X-Unix] Re: Korn shell?

William H. Magill magill at mcgillsociety.org
Wed Apr 13 10:49:28 PDT 2005


On 13 Apr, 2005, at 03:07, Kuestner, Bjoern wrote:
>> Would anyone care to provide a quick rundown of the pros & cons of
>> Korn vs. bash?
>
> http://docs.rinet.ru:8080/UNIXs/ch13.htm
>
> If you come from a long time Unix background you'll probably prefer 
> ksh,
> because it's the default for many "true" Unix systems.

"sh" is the original shell -- found in the original ATT Unix and later 
"enhanced" in System V it was good for scripting use, but not so good 
for interactive use. (Later also called "shv" or the System V shell.)

"csh" was developed by Berkeley along with BSD to be a good interactive 
shell, but not so good for scripting.

In the commercial world the POSIX committee combined "the best" (some 
say the worst) of both sh and csh and adopted the Korn Shell - "ksh" as 
the POSIX standard shell.

MIT (I think it was) was responsible for hybridizing csh and sh into 
what became the dominant interactive shell in the Unix world, tcsh... 
but it still had scripting issues.

The along came Linux and we "The Bourne again Shell," "bash." Bash was 
created to bypass all the various patent and copyright issues 
surrounding the existing shells, and to, hopefully, fix the 
deficiencies in them.

Somewhere about that same time "zsh" was also developed -- zsh provides 
"complete" sh, shv, and ksh operating modes for scripting, and, if I 
remember correctly, "complete" compatibility with "csh." But at its 
heart, it is most like "ksh."

In 10.0, Apple provided "sh" functionality by linking sh to zsh... 
which meant that ksh was available through the same mechanism. 
(/bin/ksh was a link to /bin/zsh.) In 10.1 or 10.2, I forget which, 
Apple dropped that link.

> If you deal more with Linux you'd probably prefer bash where it is the
> default.
>
> But both are available on either platform. In fact, I have installed 
> ksh on
> my Panther system. ksh for Panther is a free download.

Or you can create it by linking to zsh: " ln -s /bin/zsh /bin/ksh "

> I prefer the ksh scripting syntax over that of bash. On the other side 
> bash
> seems to have many shortcuts that could be useful under special
> circumstances.
>
> I don't think that Apple will make ksh the default. With so much 
> hoopla over
> Linux and bash dominating the Linux shell world I don't see why they 
> should
> change. And Apple would probably really irritate some sysadmins if they
> changed the default shell again.

This is an especially true statement, maybe ... the reason that tcsh 
was dropped in favor of bash is that the prime engineering advocate for 
tcsh left Apple ... and all of the "new hires" had Linux backgrounds, 
not Unix.

However, it appears that the implementation of "ksh" is strictly a 
marketing function:
     "Run scripts written for Sun Solaris more easily via AT&T’s ksh."

That is to say, Xserve is eating Sun's lunch (as well that of other 
Enterprise Unix vendors!) and "ksh" just makes it that much easier to 
pitch migration to Enterprise Computing staffs who are Unix based and 
still believe in "Open Standards."

As for the differences between ksh and bash -- Dartmouth has one 
comparrision ...
http://www.dartmouth.edu/~rc/classes/ksh/ksh-vs-sh.html

In the end, it basically comes down to the simple question -- do you 
use "print" or "echo?"

Or which shell did you learn first?

While the differences between csh or tcsh and ksh or bash are notable 
and frequently significant, the differences between ksh and bash are 
nowhere near as significant.

Personally, I've always used ksh because it is a "standard shell" which 
runs on every contemporary commercial Unix platform I've needed to use. 
I can therefore port my environment from one platform to another with 
very minimal effort and wind up with a user environment on the various 
proprietary versions of Unix(tm) that is both identical, and structured 
the way I want it. It makes cross-platform System Administration much 
much easier.


T.T.F.N.
William H. Magill
# Beige G3 [Rev A motherboard - 300 MHz 768 Meg] OS X 10.2.8
# Flat-panel iMac (2.1) [800MHz - Super Drive - 768 Meg] OS X 10.3.8
# PWS433a [Alpha 21164 Rev 7.2 (EV56)- 64 Meg] Tru64 5.1a
# XP1000  [Alpha 21264-3 (EV6) - 256 meg] FreeBSD 5.3
# XP1000  [Alpha 21264-A (EV 6.7) - 384 meg] FreeBSD 5.3
magill at mcgillsociety.org
magill at acm.org
magill at mac.com
whmagill at gmail.com



More information about the X-Unix mailing list