Why there are multiple shells in a Unix like system?

I have just started learning the fundamentals of Unix and wondering why there are so many shells in a unix like system . From the book Advanced programing in Unix Environment:

A shell is a command-line interpreter that reads user input and
executes commands.The user input to a shell is normally from the
terminal (an interactive shell) or sometimes from a file (called a shell

And then the book goes on to list a number of shell programs like Bourne shell,Bourne-again shell,Cshell, etc . My question is basically why do we need multiple shells ?

Asked By: Geek


Because people have different needs and it’s good to have alternatives fitting your needs in the given situation. A shell is just a tool on its own and should be replaceable by any other in my opinion. That’s the power of Unix/Linux, opposed to what Microsoft Windows has chosen to be.

Similarly… Why are there so many text editors? Why people develop a new browser if there’s already one? Why is there GNOME, KDE, Xfce, LXDE, E17, etc.?

Answered By: gertvdijk

Short Answer

Due to a weird licensing history, no single entity has developed Unix. It was a community process where both volunteers and corporations have participated. These entities didn’t always share all their tools, so separate shells happened. By the time we realized how counter productive this is, it was too late to unify all the shells in use. Instead work has been done to ensure that all these shells would be (theoretically) compatible with one another.

The long answer is complex and tightly linked to the history of Unix itself. There’s no way it will hold on a single answer on this page, but it’s been widely (mis)documented. You will find more detailed and precise answers by looking around the web and books dealing with Unix history.

Answered By: rahmu

Most shells used in modern UNIX environments are meant to conform to the POSIX sh specification. POSIX sh is derived from the original Korn shell (ksh88), which is in turn derived from the earlier Bourne shell, but POSIX sh only specifies a small subset of even ksh88’s functionality. A shell that only implements the minimum requirement is missing many features required for writing all but the most trivial of scripts in a safe and reasonable manner. For example, local variables and arrays are non-standard extras.

Therefore, the first reason is to extend the shell with extra features. Different shells choose to focus on different things. For example, Zsh focuses on advanced interactive features while ksh93 (the current “original” korn shell) focuses on powerful programming features and performance. Even very minimal shells like Dash add at least a few non-standard extras like local variables.

Extra features are rarely widely interoperable, if at all. Most of the ksh88 featureset is fairly well interoperable such as the extended globbing syntax, but with non-standard features, there are no guarantees, and you must really know what you’re doing to use them in a portable way.

The second reason is legacy. There are still a lot of proprietary Unixes out there that use ancient non-standard implementations for their /bin/sh. Until recently, Solaris still used Bourne as their defuault and chose to maintain the Heirloom shell rather than upgrade to something modern. These systems usually come with different shells you can switch to, for instance by changing your PATH variable or altering shebangs within individual scripts.

So to summarize. There are multiple shells, often by default:

  • For extra features, especially for dealing with non-portable extras.
  • To handle legacy scripts which are often unmaintained.
  • size / performance. Embedded systems often require small shells like mksh or busybox sh.
  • Licensing reasons. AT&T ksh was proprietary software until around 2000 or so. This is largely what gave rise to all the ksh-like clones such as Zsh and Bash.
  • Other historical reasons. Though not very popular today, there have been radical attempts at redesigning the language, such as scsh and es. The process substitution feature of many shells originally comes from rc (with a bit different syntax), and brace expansion from csh. Different shells have different combinations of such features available, usually with some subtle or not so subtle differences.
Answered By: ormaaj

Mostly, history…

Bourne was developed as part of (the propriety) SysV Unix, while BSD used csh… Later, bash was developed as a open-source alternative to Bourne shell (and its improved versions, like ksh). A Bourne-like shell was adopted in the POSIX standard. ksh is compliant and bash can be compliant.

Shells like csh and tcsh is much easier to use interactively than the original Bourne shell (which lack command completion, etc) but are horrible for scripting

In some environments, such as Unix-based embedded systems, scripting features, size and speed is more important than interactive features like command completion, and a different variant of the shells tend to be used.

For portable scripting, you should use a POSIX compliant Bourne-variant and avoid extensions.

Answered By: Gert van den Berg

Different shells exist for the same reasons as different web browsers exist: everyone has a preference, and some shells have historical baggage or momentum. Each has different features and idiosyncrasies.

Answered By: dotancohen
Categories: Answers Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.