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.



Related Posts:

  • ifconfig ifconfig command examples Use ifconfig command to view or configure a network interface on the Linux system. View all the interfaces along with status. $ ifconfig -a Start or stop a specific interface using up and… Read More
  • man   man command examples Display the man page of a specific command.    $ man crontab When a man page for a command is located under more than one section, you can view the man page for that command from… Read More
  • mysql  mysql  command example mysql is probably the most widely used open source database on Linux. Even if you don’t run a mysql database on your server, you might end-up using the mysql command ( client ) to connect … Read More
  • less    less command examples less is very efficient while viewing huge log files, as it doesn’t need to load the full file while opening. $ less huge-log-file.log One you open a file using less command, follow… Read More
  • kill kill command examples Use kill command to terminate a process. First get the process id using ps -ef command, then use kill -9 to kill the running Linux process as shown below. You can also use killall, pkill, xkill … Read More

0 comments:

Post a Comment