Trying out ksh93

6:01 pm General, Indiana, OpenSolaris

One of the hotly debated issues since we launched last week was around the addition of /usr/gnu/bin to the default path, along with the addition of bash as the default user shell. I’ve been a bash user for a pretty long time, and never really found that it got in the way much (especially compared to the older generation shells). I’ve never really had much of a reason to change.

This week I’ve decided to make ksh93 my default shell, downloaded and installed from Roland’s excellent snapshots. While I use the command-line pretty much every day, I certainly don’t use it extensively for scripting, and I probably mostly care about tab completion, and clearing my terminal window.

For tab completion, ksh93 lists the options by number and details the path, allowing you to choose one by a simple ‘N<tab>’ key combination –

gman@rampage:~$ z
 1) /usr/bin/zipgrep                  10) /usr/bin/zcat
 2) /usr/bin/zsh-4.3.4                11) /usr/bin/zipcloak
 3) /usr/bin/zipsplit                 12) /usr/sbin/zlogin
 4) /usr/bin/zipnote                  13) /usr/sbin/zoneadm
 5) /usr/bin/zip                      14) /usr/sbin/zpool
 6) /usr/bin/zsh                      15) /usr/sbin/zdump
 7) /usr/bin/zipinfo                  16) /usr/sbin/zic
 8) /usr/bin/zenity                   17) /usr/sbin/zonecfg
 9) /usr/bin/zonename                 18) /usr/sbin/zfs

which feels pretty useful, though less useful when you type ‘gnome <tab>’ since the output is now a single column. With bash you get a similar single column output, but it is piped through more to avoid having to scroll up later. Tab completion also seems a little awkward with ksh93 if you get part of the path wrong, since it seems to add 4 spaces after you tab making it look as if the completion succeeded.

For clearing a screen, ksh93 at the moment seems a lot more irritating. The key combination is ‘<esc><ctrl>l’, whereas bash is just ‘<ctrl>l’. I’m sure the ksh93 one is doing something more, but well, gets in the way for my use.

I’ll continue for the rest of the week and see how it all works out. I do like the shnote, shtinyurl, and shtwitter scripts in /usr/demo/ksh/fun though!

5 Responses

  1. Roland Mainz Says:

    1. Erm… the “more” stuff is coming later… it was obmitted because the current behaviour of “bash” causes problems for old terminals and we need to figure out how to make it better…
    2. “clear sceen” is “”, not something with . We used this based on accessibilty considerations since “clear” screen is a more destructive action and therefore warrants a two-key sequence that noone accidently ruins his/her terminal output.
    3. The “akward” 4 spaces added when a filename/variable/etc. cannot be completed is a charatcer. That was done to allow people entering a without falling-back to (may be debateable but the more traditional Unix users seem to prefer this method…).

  2. Marc Says:

    It seems quite normal to me that different shells have different strong points. ksh93 is unbeatable on performance. zsh has the most “features” (though ksh93 has other ones) and the most advanced completion system but is slow and does not support utf-8 so well. Bash is probably the shell that got the most testing. So globally I would tend to use ksh93 for scripting, and for interactive use zsh if I can live with latin1 and bash otherwise. What I would not do is give up an interactive shell I am used to, it takes too much time getting used to anything new…

  3. UX-admin Says:

    bash has been made the default shell for new users?!?!?!

    We’re SO SCREWED. Now the bash garbage scripts will proliferate, incompatibility will increase, and those Linux immigrants will never learn to program properly, or hear about tcsh.
    Wow. From bad to worse. Wow.

  4. Jakub Steiner Says:

    Love the 8)

  5. Roland Mainz Says:

    > So globally I would tend to use ksh93 for scripting, and for interactive use
    > zsh if I can live with latin1 and bash otherwise.

    1. Technically would disagree on the “use bash for non-latin1”-locales. “bash” has lots of horrible bugs when used for non-UTF-8 multibyte locales such as ja_JP.PCK or zh_CN.GB18030 – which was one of our main work to make sure ksh93 doesn’t suffer from the same problems (as a result of that work ksh93 even allows to use multibyte characters for variable and function names… 🙂 )

    2. Small comment about testing: ksh93 comes with a large test suite which is _shipped_ even with Solaris by default to verify that the ksh93 binaries in the OS are working properly. AFAIK ksh93 is one of the most tested shells right now in Solaris (and based on my experience with “bash” I can’t say the same for “bash” which appears to be build&&dumped on the users without testing… ;-(( ) …