Bourne shell

What is the Bourne shell?

The Bourne shell is the original Unix shell — command execution program, often called a command interpreter — that was developed in 1979 at what at the time was Bell Labs. Named for its developer, English computer scientist Stephen Bourne, the Bourne shell is also known by its program name, sh. The Bourne shell family also includes the Korn shell, bash (Bourne Again Shell) and the Z shell (zsh).

The Bourne shell is used for scripting. It provides command-based programming to interpret and execute user commands. As a user types a command, the shell interprets it so the operating system can take action, such as automating a task. The Bourne shell was the default shell for Unix version 7. The shell prompt used in command prompts is the $ symbol.

Bash is the free replacement version of the Bourne shell that’s distributed with Linux systems. Bash is similar to the original Bourne shell but has added features, such as command line editing. Its name is sometimes spelled as “Bourne Again SHell” — the capitalized “Hell” referring to the difficulty some users have with it.

While a student at Princeton University, Paul Falstad created zsh in 1990 as a replacement for both the Bourne and C shells. The zsh shell incorporates features of the other shells — such as file name completion and a history mechanism — as well as other new capabilities that make it more interactive and customizable. Falstad intended to create a shell with zsh. Zsh is similar to the Korn shell and can emulate POSIX shells, but it isn’t compatible with either shell.

Along with the Korn shell and the C shell, the Bourne shell remains among the three most prominent shells in all Unix systems. However, it’s more likely for a shell such as Bash or dash to be used for scripting, like in the following example:

!/bin/sh
# Hello world!
Echo Hello World

The first line is the file being executed by /bin/sh. The second line, which starts with a #, marks the line as a comment to be ignored by the shell. The third line is an echo command that puts a space between parameters.

In Linux, the Bourne shell was replaced by Bourne-compliant shells like dash. Even when switching to the Bourne shell on Linux, it’s most likely a modern iteration in use. Users who want to switch from Bash to Bourne can change the shell without having to install anything. They can open a terminal window, issue the chsh command and follow the prompts.

Bash is also similar to Windows PowerShell, as they both use a command line interface. Windows administrators can use Bash, but it doesn’t stack up quite like PowerShell. PowerShell, which is based on the Microsoft .Net framework, is cross-platform and works on Windows, Linux and macOS.

Learn how Bourne and Bash shells compare, including the steps involved in switching between the two shells.

Leave a Reply

Your email address will not be published. Required fields are marked *

Translate ยป