Thursday, May 15, 2014

Introduction of Shell Scripting


What is Shell ??
A shell is simply a program that is used to start another program. Shell accepts your instruction or commands in English (mostly) and if its a valid command, it is pass to kernel.

All operating system have shells. For example DOS have command.com, Windows have explorer.exe.



Several shell available with Linux including:

Shell Name
Developed by
Where
Remark
BASH ( Bourne-Again SHell )
Brian Fox and Chet Ramey
Free Software Foundation
Most common shell in Linux. It's Freeware shell.
CSH (C SHell)
Bill Joy
University of California (For BSD)
The C shell's syntax and usage are very similar to
the C programming language.
KSH (Korn SHell)
David Korn
AT & T Bell Labs
--
TCSH
See the man page.
Type $ man tcsh
--
TCSH is an enhanced but completely compatible version of the Berkeley UNIX C shell (CSH).

To find all available shells in your system type following command:
$ cat /etc/shells

Normally shells are interactive. It means shell accept command from you (via keyboard) and execute them. But if you use command one by one (sequence of 'n' number of commands) , then you can store this sequence of command to text file and tell the shell to execute this text file instead of entering the commands. This is know as shell script.

Why to Write Shell Script ?
  • The first thing most people will use shell scripting for is automating a simple task, like backups.
  • Shell script can take input from user, file and output them on screen.
  • Useful to create our own commands.
  • Save lots of time.
  • To automate some task of day today life.
  • System Administration part can be also automated.



0 comments:

Post a Comment