Shell Scripting today is something which is gaining attention of most of the programmers because of companies shifting their working platform to LINUX/UNIX. Firstly the question that strikes everyone’s intelligent mind is- Why Linux? Because it is really fun working over it. It is quick. It supports virus less networking and comes with software centre from where we can select and install applications, and similarly Linux provides several powerful administrative tools and utilities which will help us to manage our systems effectively.
Secondly, what is so special about shell programming and why we have to use it?
• Shell Scripting save significantly on our time. The amount of time which we are spending in doing tasks manually can be saved by automating those tasks using scripts.
• Retyping and executing the same set of commands manually every time with different values to complete similar tasks sounds so irritating. Scripts save us from this irritation as well.
• Complete complex tasks in a single line by combining multiple Linux commands and one or more Bash builtins.
• When there is a possibility that you might perform a task again at some point, write a bash shell script instead of manually performing that task.
• It is very convenient to debug the shell programs
It is basically the interface between us and the kernel of LINUX/UNIX operating system. If we have to get a task done, for example we want a document to be printed then we issue a command to the shell, shell interpreters that command and convert it into something which the kernel can understand.
KERNEL is a program that manages the system resources or the hardware. It is responsible for all major activities of this operating system. It is consists of various modules and it interacts directly with the underlying hardware. It takes the instruction from the shell and it would further translate it into something that the hardware can understand.
TERMINAL- is an application through which we can access the Shell. U can find the terminal is the the task bar or search for it as shown in below figures. It is basically present under the applications category in the accessories.
Figure 1
Figure 2
What happens when we open the TERMINAL-
We will see a statement being displayed similar to following-
bhavnaaggarwal@ubuntu:~$
• bhavnaaggrwal here is my user name
• ubuntu is the name my machine
• $- this symbol represents my shell
• this statement is followed by a cursor where we can type the command and when we press ENTER the command gets executed
• One important thing we all have to remember is that all Linux commands are input in lower case alphabets.
• Sh SHELL
• BASH- bourne again sh shell
• C shell
• K shell
• T shell
• Z shell
To know the list of all the shell installed on your LINUX operating system, type the following command-
cat /etc/shell
Figure 3
To know your default working shell
echo $SHELL