0% found this document useful (0 votes)
10 views8 pages

LinuxPractical - 7

Uploaded by

6.6.6.non.entity
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views8 pages

LinuxPractical - 7

Uploaded by

6.6.6.non.entity
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Practical – 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.

Types of Shells in Linux

· 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.

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.If you are using a Bourne-type shell, the $ character is
the default prompt.

For bourne shell the:

Features of the bourne shell include:

· Allows both synchronous and asynchronous execution of commands

· Supports input and output redirection and pipelines

· Provides a set of built-in commands

· Provides flow control constructs, quotation facilities, and functions.

· Typeless variables

· Provides local and global variable scope

· Scripts do not require compilation before execution


Built-in Commands

The GNU Bourne-Again Shell(Bash): The Linux Bash is also known as


'Bourne-again Shell.' It is a command language interpreter for the Linux based system. It
is a replacement of Bourne shell (sh). It was developed under the GNU Project and
written by Brian Fox. Nowadays, Bash is the default user shell of most of the Linux
distributions.

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.

The Bash is a command language interpreter as well as a programming language. It


supports variables, functions, and flow control, like other programming languages. It can
also read and execute the commands from a file, which is called a shell script.

For the GNU Bourne-Again Shell:


Features of Bash

· Aliases, which allow you to define shorthand names for commands or command

lines.

· Command history, which lets you recall previously entered commands.

· Brace expansion, for generating arbitrary strings.

· 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 is an interactive command interpreter and a command programming language


that uses syntax similar to the C programming language. The shell carries out commands
either interactively from a terminal keyboard or from a file. The csh command invokes
the C shell.

The C shell also introduced the standard tilde notation where "~" represents a user's home
directory.

In C shell the:

Features of the C shell include:

· Input/output redirection

· Wildcard characters (metacharacters) for filename abbreviation

· Shell variables for customizing your environment

· Integer arithmetic

· Access to previous commands (command history)

· Command name abbreviation (aliasing)

· A built-in command set for writing shell programs

· 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.

For the Korn Shell the:


Features of Korn Shell include:

· Aliases, which allow you to define shorthand names for commands or


command lines.

· Functions (included in some C shell versions), which increase


programmability and allow you to store your own shellcode in memory instead
of files.

· Command history, which lets you recall previously entered commands.

● 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

You might also like