Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Do shells have any actual advantages or disadvantages? They can all run any binary, they all support pipes and > (output to file). Why would one choose bash over sh, or sh over ksh, etc? Why does any shell other than sh exist in the first place?

share|improve this question
Have you ever tried to use something like dash as your interactive shell? –  jordanm Feb 2 '13 at 17:43
@jordanm no, because I've never had any reason to use anything but bash other than using up two characters fewer on each line. –  tkbx Feb 2 '13 at 17:46
Technically they don't run any binaries, they run a system command that asks the kernel to do so, since only the kernel can do so. –  TAFKA 'goldilocks' Feb 2 '13 at 21:02
add comment

closed as not constructive by jasonwryan, Shadur, uther, rahmu, warl0ck Feb 3 '13 at 8:07

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers

up vote 2 down vote accepted

sh is/was the Bourne shell. bash is the Bourne Again Shell.

Bash includes all the features of sh and is intended to provide backward compatibility for sh scripts, which is why sh is a symlink to bash on GNU (linux) systems. There are apparently some potential obscure glitches in this compatibility, but they are probably not too significant.

So in terms of functionality, bash is superior to sh; it does everything sh does and a whole lot more. Note that finding a system which uses the original sh might not be so easy.

However, bash is has a strong copyleft open source license (GPL 3+), meaning it has some socio-political/pragmatic/logistic advantages or disadvantages, depending upon the context of use.

Apparently there is a Hollywood blockbuster action trilogy about the whole thing, starring Matt Daemon ;)

Nowadays, sh may refer to a specification for a system shell; here is the POSIX version:


In other words, in that context "sh" does not refer to a particular shell but a standard to which a particular shell conforms.

share|improve this answer
No sh is no longer the Bourne shell. Just like it was no longer the Thomson shell when the Bourne shell came out and became the new de-facto standard. Now sh is a standard specification of a language based on a subset of ksh88, no longer an implementation. Or said otherwise, sh are a lot of different implementations of an interpreter for that sh specification. bash is the sh of the GNU project, the main reason why it's so widely used despite not being the best of shells. –  Stephane Chazelas Feb 2 '13 at 18:17
Fair enough. Well, there is the history anyway. Somebody should write a wikipedia entry for sh then, since it redirects to "bourne shell". I'll add a bit about the POSIX spec for sh... To be fair, sh in the context of "a shell" would refer to the bourne shell, and not a specification. –  TAFKA 'goldilocks' Feb 2 '13 at 18:23
The "and a whole lot more" is what I'm trying to find out. –  tkbx Feb 2 '13 at 22:08
@tkbx : there's a few things mentioned in the wikipedia page -- regular expressions, associative arrays. You'll probably find a ton of stuff in the NEWS or CHANGELOG file of the source. "Differences between shells" in a pragmatic here and now sense is not really about sh and bash, since in colloquial and practical terms on a POSIX system, sh == bash. I wrote this post to clear that up. The Korn shell and C shell are their own story and would make for a more interesting contrast. –  TAFKA 'goldilocks' Feb 2 '13 at 22:27
add comment

Mostly common differences you may find in Difference between ksh,bash and different shells post on unix.com My opinion that it is like a choice different distros. Everyone chooses what he likes.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.