SPUG: aliases, -> Korn Shell vs. PD-ksh

Richard Anderson richard at richard-anderson.org
Mon Feb 3 04:19:11 CST 2003

Here's an example of one of pdksh's design flaws:
#! /bin/ksh
ls -1AF | while read file
   [[ $file = */ ]] && dir=yes
[[ $dir = yes ]] && print "Found directory"
This works with the 1988 and 1993 Korn shell, but not with any versions of
the public domain Korn shell.1 (There is a design flaw in pdksh that makes
it run the last command of a pipeline in a subshell, so when the loop
finishes the effect of resetting $dir is lost. Bash and the Bourne shell
also have this non-intuitive behavior.)

When I brought this to the attention of pdksh's maintainer, he insisted that
pdksh is right and ksh is wrong, in spite of the fact that pdksh is supposed
to be a public-domain implementation of ksh!

Regardless, pdksh is no longer being maintained.  Now that ksh93 is
available under the AT&T open-source license, the only reason to use pdksh
is laziness or compatibility with existing infrastructure.

Richard Anderson
richard at richard-anderson.org
----- Original Message -----
From: "SPUG-list-owner" <tim at consultix-inc.com>
To: "Brian Hatch" <spug at ifokr.org>
Cc: "SPUG-list-owner" <tim at consultix-inc.com>; <spug-list at pm.org>
Sent: Friday, January 24, 2003 5:34 AM
Subject: Re: SPUG: aliases, -> Korn Shell vs. PD-ksh

> On Thu, Jan 23, 2003 at 07:26:39PM -0800, Brian Hatch wrote:
> >
> > > There's no reason to use the crappy PD-ksh that ships with the free
> > > UNIX-like systems (unless it's improved drastically in the past 18
> > > months, since I last rejected it).  That's because for years now,
> > > you've been able to get the real Kornshell for free from the AT&T
> > > research web site.
> >
> > What has pdksh not done correctly for you?  I haven't had a
> > problem with it ever.
> I teach a 4.5-day class called "Advanced Shell Programming",
> and delivered that to some Fortune 500 company somewhere a few
> years back.  Despite the fact that my software setup instructions
> specifically indicated that they should provide the Korn shell,
> they provided the PD-ksh instead, and insisted on using it.  I had
> toyed with it a bit and found no obvious problems, so agreed to give
> it a shot.  Well, we (myself and the 16 students) proceeded to find
> a new problem with the PD-ksh about every 5 minutes for the rest of
> the week, and many of my programming examples (using co-processes,
> IPC, signals, exec, eval, etc.) did not work at all properly.
> It was an unmitigated disaster, so I resigned myself to never let
> that happen again.  Sorry, I don't remember the details of what the
> exact differences, or outright failures were, just my conclusion
> that just about everything it did it did differently than the real
> thing, if at all.
> But I'm not a shell zealot; if you like this shell (which may have
> been thoroughly rehabilitated by now, for all I know), be my guest,
> and enjoy it.  Personally, I'll stick with the actual Korn shell,
> because it's equally free, rock-solid, and very extensively tested
> by decades of programmers doing tricky stuff.
> >   None of this 'alias rm="rm -i"' crap.
> >
> > That's why I don't use bash.  But having had no problems
> > with pdksh, I don't see any reason to go out and
> > compile at&t's version when my distro already comes
> > with pdksh.
> > Brian Hatch
> No need to compile it, you can download a Linux (or whatever)
> executable for free.
> -Tim
> *------------------------------------------------------------*
> |  Tim Maher, CONSULTIX    (206) 781-UNIX    (866) DOC-PERL  |
> |  CEO, JAWCAR ("Just Another White Camel Award Recipient")  |
> |  tim at consultix-inc.com  teachmeunix.com  teachmeperl.com   |
> *+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-*
> |  Ask about on-site classes on Perl, UNIX, & Linux topics!  |
> *------------------------------------------------------------*
> _____________________________________________________________
> Seattle Perl Users Group Mailing List
> POST TO: spug-list at mail.pm.org
> ACCOUNT CONFIG: http://mail.pm.org/mailman/listinfo/spug-list
> MEETINGS: 3rd Tuesdays, U-District, Seattle WA
> WEB PAGE: www.seattleperl.org

More information about the spug-list mailing list