LinuxPractical - 7
LinuxPractical - 7
Aim :To study Bash shell, Bourne shell and C shell in Linux operating system.
What is a shell
A shell is a special user program which provides an interface to user to use operating
system services. Shell accepts human readable commands from user and convert them
into something which kernel can understand. It is a command language interpreter that
execute commands read from input devices such as keyboards or from the files. The shell
gets started when the user logs in or start the terminal.
Shell is an environment in which we can run our commands, programs, and shell scripts.
There are different flavors of a shell, just as there are different flavors of operating
systems. Each flavor of shell has its own set of recognized commands and functions.
Shell Prompt
The prompt, $, which is called the command prompt, is issued by the shell. While the
prompt is displayed, you can type a command.
Shell reads your input after you press Enter. It determines the command you want
executed by looking at the first word of your input. A word is an unbroken set of
characters. Spaces and tabs separate words.
· Bourne shell
· Bash shell
· C shell
· Korn shell
Bourne shell(sh) : The Bourne shell, called "sh," is one of the original shells,
developed for Unix computers by Stephen Bourne at AT&T's Bell Labs in 1977. Its long
history of use means many software developers are familiar with it. It offers features such
as input and output redirection, shell scripting with string and integer variables, and
condition testing and looping.
· Typeless variables
The Linux/Unix shell allows us to interact with the Linux system through the commands.
It let us invoke an executable file to create a running process. Moreover, it also allows us
to interact with the Linux file system. It is designed in such a way that we can perform all
the Linux operations through Bash.
· Aliases, which allow you to define shorthand names for commands or command
lines.
· Key bindings that allow you to set up customized editing key sequences.
· New options and variables that give you more ways to customize your environment.
· One dimensional arrays that allow easy referencing and manipulation of lists of data.
Built-in Commands
C shell(csh) : The C shell was created at the University of California by Bill Joy. It is
denoted as csh. It was developed to include useful programming features like in-built
support for arithmetic operations and a syntax similar to the C programming language.
The C shell also introduced the standard tilde notation where "~" represents a user's home
directory.
In C shell the:
· Input/output redirection
· Integer arithmetic
· Job control
Built-in Commands
Korn shell(ksh): The Korn shell was developed at AT&T Bell Labs by David Korn, to
improve the Bourne shell. It is denoted as ksh. The Korn shell is essentially a superset of
the Bourne shell.
Besides supporting everything that would be supported by the Bourne shell, it provides
users with new functionalities. It allows in-built support for arithmetic operations while
offering interactive features which are similar to the C shell.
The Korn shell runs scripts made for the Bourne shell, while offering string, array and
function manipulation similar to the C programming language. It also supports scripts
which were written for the C shell. Further, it is faster than most different types of shells
in Linux, including the C shell.
● New options and variables that give you more ways to customize your
environment.
● Increased speed of shell code execution.
● Security features that help protect against "Trojan horses" and other types of
break-in schemes.
Built-in Commands