Learn Korn shell scripting, or something else?

I find myself in a new job where we have a mixed UNIX and Linux environment. Korn shell is the primary shell on the UNIX boxen, and we’re likely to keep them for the next 5-10 years. Since ksh is readily available on RHEL, it seems that Korn shell is the common denominator. So I’m trying to learn it by tackling small personal projects. So far I’ve done a couple of simple projects to get familiar with functions, associative arrays and other random bits. Hopefully this will come in handy for some of the random sysadmin tasks I occasionally need to do.

My programming experience is pretty weak; I developed a price quoting system in Access years ago, but haven’t done anything lately. I’ve tinkered with various flavors of BASIC and taken courses in C++, FORTRAN and COBOL years ago. But I’ve never really considered a career in programming because I had very little patience for debugging, or traditional learning methods. But in working on these small ksh projects I’ve found that my mood has stayed pretty mellow and I haven’t really lost my temper.

I don’t do well learning from books or in any sort of structured way. I usually do best by taking on small projects, learn what I need to complete them, and gradually move on to more complex undertakings.

So should I continue to learn Korn shell? What resources are available? I know it’s pretty dated, but it’s likely to continue being used at work for years. Someone at work suggested learning Python instead. I know it’s on the RHEL boxes at work, but I’m not sure about the UNIX ones.

Do they also have bourne shell (as in “sh”)? Just because ksh may be your login shell, doesn’t mean you need to write scripts with it.

I think that learning bourne shell scripting would perhaps be more versatile (in terms of “this script will run on any system”, bash is a superset of it.

Awk (or perl) is also worth learning for scripting if “sh” can’t do it as it is basically everywhere and more powerful than regular shell.

Usually ksh is used for high performance shell scripts. If what you’re doing doesn’t benefit from the performance then it’s best to learn something more general like Bourne or Bourne-again shell. As this is what’s typically the default shell on every linux distribution, so you will be able to apply your knowledge more effectively across different (potentially future) environments.

I know for a fact that IBM uses Korn-shell for HA stuff on their power systems. So its definitely worth learning. But be sure to keep what I said in mind.

2 Likes