Shell & Shell Scripting
Shell is the medium or intermediator between the user and computer and act as an form of wrapper around the Operating system hence termed Shell. It helps the user to connect with the system kernels to perform huge and various task hence the shell scripting is needed. Shell interpret the commands that acts as an interface for the access to operating system services such as Unix, Linux, Windows etc. Shell is the layer of programing on the outermost layer of the operating system which interprets commands and send necessary system calls to the kernel for execution of program. Today, there are many shells avavilable like bash, bsh, ksh, csh, zsh powershell etc. Among all the shells “bash” is the most and frequently used shell world wide. Shell is capable of automate very complex sequences of commands and most linux system are designed to be updated from typed in commands i.e. from shell. Shell also powers many of graphical commands that is run by users. Shell plays the most important role to better understand the computer. See below figure to better understand.
Linux Shell
Shell classified in two categories.
-
Command Line Shell
-
Graphical shell
Command Line Shell:- Shell can be accessed by user using command line interface i.e. called Terminal in linux or Unix operating System. And Command Prompt in Windows operating System. Shell takes commands by user and call operating system to run those commands.
For Example: ls, ls -a, cat, etc.
Graphical Shell:-Graphical shells provide means for manipulating programs based on graphical user interface (GUI), by allowing for operations such as opening, closing, moving and resizing.
Shell Scripting
Usually, shells accepts commands as input from users and execute them. But sometimes we need to perform multiple operations using several commands hence to perform these operations we have to type all commands one by one to get the result.
So to avoid repetitive work and run all commands at once we need Shell Scripting. In Shell scipting we group number of commands in a file, and when you run shell script file, shell will executes the commands in the script file order. A shell script have syntax just like any other programming language.
Shell scripts consist below mention elements:-
-
Shell Keywords
-
Shell commands
-
Functions
Advantages of Shell & Shell Scripting
-
Shell can automate very complex sequences of commands.
-
Shell allows you to create new commands using other commands.
-
Scripting helps you to add new functions easily to the shell.
-
Writing shell scripts are much quicker and easier.
-
Interactive Debugging.
Disadvantages of Shell &Shell Scripting
-
Graphical environment is not userfriendly which is why scripting is being used less.
-
Provide minimal data Structures.
At last we must say, learning the Shell Scripting can help you better understand your computer.