I hope everyone heard about Linux Operating System before. Like other Operating Systems Linux also is made of many components. But here to get an Introduction to the Linux Shell Scripts, we need to know about its major/important components Kernel and Shell.
We studied that Operating System is a software that manages computer Harware and provide an interface between Computer Hardware and Users/Softwares. Kernal is the component/program responsible for first task of an OS, that is managing computer Hardware. And Shell is the component/program responsible to provide the interface for the users/softwares with hardware.
We can graphically get an idea of it as shown in following Image.
Kernal and Shell of Linux OS |
Let's see about Linux Shell more in details.
A shell is program which acts like an interpreter. It convert human readable commands received from input devices into something which kernel can understand. The shell starts to run when a user logs in or prompt the terminal.
Rather than a command interpreter, Linux Shell is also a command language itself. It has complete command language constructs such as conditional execution, loops, variables, functions etc. So that Unix/GNU Linux shell is more powerful compared to the Windows shell.
A Linux System may contains different types of Shells, each type has unique features. These types of shells can be divided into major two parts.
1. The Bourne Shell: (prompt with $)
- Bourne Again SHell also known as bash, is the most popular one.
- POSIX shell also is known as sh
- Korn Shell also knew as sh
2. The C shell: (prompt with %)
- C shell also is known as csh
- Tops C shell also is known as tcsh
Let's move to Shell Scripting.
Instead of providing commands one by one to the shell, we can provide them as a bunch of commands. This bunch of command is called as Shell Script and writing the bunch/sequence of commands is called as Shell Scripting.
Since Shell is a program, Shell scripting is a command language and it has its own syntax's, commands, keywords, functions, and control flow just like any other programming language.
Why do we need Shell Scripts?
- Task Automation
Sometimes we need to do some tasks daily or frequent tasks. With Shell Scripts we can program them and do automatically. - Run Multiple Commands at a time.
Instead of running commands one by one, using shell scripts we can run sequence/bunch of commands at a time or in a single prompt. - Shell Scripts are portable
It means they can be executed in any Unix-like operating systems without any modification. - Easy to use, once you learned
Learning/beginning may be little bit hard, once you learned it you can complete your tasks easily using shell scripts.
Comments
Post a Comment