Operating System - HP-UX
1822897 Members
3566 Online
109645 Solutions
New Discussion юеВ

ksh88 vs. dtksh vs. ksh93 vs. POSIX

 
Tom Rosenfeld
Occasional Advisor

ksh88 vs. dtksh vs. ksh93 vs. POSIX


I have been using ksh88 for years and am considering upgrading to ksh93, but I have some questions:

1st of all should I jump to ksh93 or just move to the POSIX shell (/usr/bin/sh) since it has most (?) of the ksh93 features and is the standard? It presumably also has better support, as it is the default HP-UX shell.

If I want to use ksh93, is dtksh a good choice? I don't need any of the X features and I am concerned about the extra overhead and process size. Also, how close is dtksh to ksh93? The version string shows "93d" although the latest ksh93 is at least "93h". I know I can get binaries (and source) at www.kornshell.com but there are licensing restrictions there for commercial use. Does HP provide a version of plain vanilla ksh93 without the X features?

Thanks,
-tom
4 REPLIES 4
Bill McNAMARA_1
Honored Contributor

Re: ksh88 vs. dtksh vs. ksh93 vs. POSIX

Here's lots of shells ported to hpux
http://hpux.connect.org.uk/hppd/hpux/Shells/

most of your scripting should remain ksh
even if there is a memory leak in it.
ref:fct_util script readmes.

Bill
It works for me (tm)
Wodisch_1
Honored Contributor

Re: ksh88 vs. dtksh vs. ksh93 vs. POSIX

Hello Tom,

it seems you have "inherited" a lot of X11
administration, have you not?

If you do not care about X11, then why using
the DestTopKornSHell (dtksh)? The POSIX shell
is able to do all that a Korn shell can, and
has to more features (which nobody needs;-)
has somebody ever used "rehash"?), well two
of them (cannot remember the second ;-( sorry).

Be careful about which one you use as login
shell: /sbin/sh is statically linked (for
trouble shooting in single-user-mode) and
/usr/sbin/sh is dynamically linked (for the
rest of us). The latter should have history
enabled, the format NOT.
As super-user export HISTFILE and HISTSIZE
in your ~/.profile and ~/.dtprofile, for those
are only used on "real" logins, i.e when the
system is up and running - in single-user-mode
you just do not login, you only get a shell,
hence no profiles are executed.
HTH,
Wodisch
Tom Rosenfeld
Occasional Advisor

Re: ksh88 vs. dtksh vs. ksh93 vs. POSIX

Wodisch,

ksh93 (as in dtksh) has many features not found in HP's posix shell. Some important examples:
-substring operations on variables
-built in printf
-floating point arithmetic

It would be nice if I could get these without the 'dt' overhead.

-tom
Blake Garretson
Advisor

Re: ksh88 vs. dtksh vs. ksh93 vs. POSIX

Tom,
I agree that those features you mention as missing from the POSIX shell are important, but I still use the POSIX shell since it is HP's default. Luckily, all of those features lacking can be accessed through other applications.

For instance, there isn't a built-in printf, but there is /bin/printf on every HP, which does the same thing. For floating point numbers, I use bc in my scripts to handle the math, and I store the values as strings. Where the POSIX shell lacks in string manipulation, I usually use sed and/or awk.

It's not as pretty as a shell that does it all, but if you want to stick with POSIX, you still can accomplish everything you need to...