Pages

Scripting -1 The Shell

Aim: To introduce the reader to the linux shell.


A Shell is nothing but an command interpreter that interprets commands entered by a user and sends it to the operating system.

The history of shell dates back to the initial days of Unix, when the shell was introduced.
Today there are various shells that are in use, some of the most popular being

Bourne shell: The very first version of shell introduced in 1970s as a part of the seventh edition Unix released by  Bell labs. The name Bourne is derived from the creator "Steven Bourne".

This shell is  a part of every distro even today. It has very basic capabilities as compared to the various other shells used today, but almost all the shells still use the similar syntax as the Bourne shell.

csh-- C shell : This shell is named as C shell because of the similarity with the syntax of C language. This became the default shell of the BSD version of Linux and was very popular because of the advanced fetures that it provided as compared to the Bourne shell.

Ksh-- Korn Shell: The popularity of the C shell was endangering  the usage of the AT&T Unix and as as result AT&T came with their own version of shell, designed by David Korn and named it as the Korn shell. The main advantage of the korn shell was that even though it had almost all the advanced features that the c shell had to offer, it was backward compatible with the Bourne shell. That is the scripts written for the Bourne shell could also be executed in the Korn shell.

This war between shells was obviously not very favorable for the  users. Because any script that was compatible with the C shell would not run on the korn shell and Vice Versa.

As a result the Bourne Again shell was created, which had the features of both c shell,korn shell,  and was also back ward compatible with the Bourne shell and above all it was freely available.

Bourne Again shell(bash) has become one of the most popular shells today.  Almost every Linux Distro in the market comes default with the bash shell. Though the others shells are also available for use.

The official POSIX standard shell is the Korn shell.

To find out what is the shell being used by your system run the following command

echo $SHELL. 

The environment variable SHELL holds the value of  the shell being used.

You can change the default shell that is used by your Linux distro using the command chsh .

Syntax: chsh username "path to shell"
for e.g.:  chsh user1 /bin/ksh


Other than these there are other shells too, like the zshell, TCshell and a few graphical shells which are rarely used.

No comments:

Post a Comment