Macos – What’s the difference between the terms “Shell” and “Bash”


What is the the difference between "Shell" and "Bash" and what do these terms mean?

As far as I know, there is no difference. But I've seen many books about "Shell" and others about "Bash"!

So in case I want to work with the Terminal on Mac OS X and write some bash scripts, I'm wondering which kind of books I should go for.

Best Answer

A "shell" is any software that provides an interface to an operating system. For instance, explorer.exe is the default shell in Windows (though alternatives exist), and on OS X Finder provides much of the same functionality. On Linux/*nix, the shell could be part of the desktop environment (like Gnome or KDE), or can be a separate software component sitting on top of it (like Unity or Cinnamon).

The above examples are all graphical shells that use a combination of windows, menus, icons and other such elements to provide a graphical user interface (GUI) that can be interacted with using the mouse cursor. However, in the context of software like Bash, or writing scripts, "shell" is usually taken to mean a command-line interpreter, which performs largely the same duties as a graphical shell, except is entirely text-based.

Bash is a specific example of a command-line shell, and is probably one of the most well-known ones, being the default in many Linux distributions as well as OS X. It was designed as a replacement for the Bourne shell (Bash stands for "Bourne again shell"), one of the first Unix shells.

Examples of command-line shells on Windows include cmd.exe (aka Command Prompt) and PowerShell.