Header Ads

Shell Scripting-Part I

Language:- Shell Script
Platfrom :- Unix/Linux
Level :- Beginners.

Before going in to Shell Scripting,just wanted to give a brief walkthrough of the following :-
1) What is Unix?
2) Flavours of Unix in Market.
3) Kernel and Shell relationship with its definition.
4) Different Types of Shell in Use.
5) Example of a command.

What is Unix:-
To start off,most of us know, what is Unix.Unix is a Operating System which was started way back in 1969 at Bell Labs.It was Ken Thomson of the Research group at bell labs started experimenting for a multitasking,Multiuser OS. Soon after that he was joined by Dennis Richie,who redisgned the OS with C programming Language.Microsoft Windows and Apple's MacOS are example of Single User,Multi Tasking System. But Unix is of Multiuser.It means multiple user can access all the computer resources simultaneously.

Some of the Flavours of Unix now available are :-
1) HP/UX by HP
2)AIX by IBM
3) Solaris by SUN
4) Linux by different distributors,which consists of a) Red Hat, b)Fedora Core, c)SuSE Linux, d)Debian.

Relationship between Kernel and Shell

A Overview of the relationship between a Kernel-Shell-User.

Kernel :- The Kernel is the core of the Operating System.It interacts with the Hardware of the machine.It is a collection of routines.Whenever the system is booted,it is loaded in to the memory.User programs(applications) access the the kernel through a set of functions called the system calls.Apart from this,Kernel manages System's memory,schedule process,decides priority and performs different set of tasks which users never bothers about.

Shell :- A Shell is often called a command interpreter and is the primary interface between the kernel and the user. Unix Shell is itself a program and is loaded in the memory once user logs in to any terminal.Once an user logs in,and enter any commands,shell translate that commands into set of system calls to the OS,All other information and any system calls from OS is again translated by the Shell infront of the user.

A detailed diagram showing how user commands are being handled by shell.

Shell have internal and external commands. For example cat,ls are external commands,whereas echo is an internal command of shell.
Note:- Will discuss in detail going forward.

Different Types of Shell in use :-
There are different types of shell that an user can use.They are :-
1)Bourne Again Shell(Bash)
2) Bourne Shell
3)Korn Shell
4)C Shell.
Bash shell is the superset of the Bourne,Korn,C shell and provides all the necessary program features.It comes mostly with all the Linux flavour available in market.

Starting with Commands :-
Once you successfully login to the Unix,you will be getting a dollar prompt($) and a blinking cursor.This is the typical UNIX prompt,and that is the default prompt which most of the UNIX system uses.
Commands :- Everything in Unix starts and ends with commands.

Type in the below details where the cursor blinks and press enter.
$echo "My Name is Madhumita Banerjee."
Output :- My Name is Madhumita Banerjee.
So,seeing the output,you can guess that echo is a command to print/display at your terminal.
Conclusion :- Thus,the article above provides a brief introduction of UNIX which includes Kernel and shell as its main component.

Note :- We will be continuing with Shell Scripting-PartII

References :-
1)Third Edition, UNIX concepts and applications By Sumitabh Das.
3) Shell Programming,Yesvant Kanetkar
4)Wilkipedia for Unix.

Powered by Blogger.