Introduction To Shell Programming - BASH
Shell Scripting or Shell Programming
Shell programming is nothing but programming in shell. A shell script is simply a script or a text file comprising of shell commands. You can use a text editor and write down the commands you want and save it in the appropriate format. If you run the file, the shell reads the commands of the text file line by line and searches for the existence of the commands and performs the necessary actions. That’s all. So from this simple explanation, it is clear that shell scripts are not compiled like source codes of ordinary programs, but they are interpreted instead.
The Shell we are going to describe here is BASH. I hope you know what a shell is. If you don’t know, no problem. I can explain it to you with in a sentence or two, in my own words. Just think about DOS in your windows system. It can do tasks based on the system commands you enter on it. That is a command prompt. So in a UNIX or Unix-like operating system, it is called a shell. That is, a shell can pass commands to the kernel to perform the demanded actions of computing.
Advantages of BASH
BASH (Bourne Again Shell) is the standard GUI shell which is a powerful element for beginners as well as professionals. Learning shell scripting is a lot fun. Never under estimate that shell scripting are useless as far as a beginner is concerned. All you need to know is some basic Linux knowledge. Out of a lot of available shells, Bash is believed to be most powerful and flexible.
I am not going to provide you a handful of commands for Bash scripting as a lot of free and paid resources are available all over the net. But I am trying to give a clear idea about bash scripting and its advantages in daily use. People usually hate Linux because there is always a myth : Linux is only for geeks who are well experienced in working with codes and commands. But the truth is not that. Linux is now very easy to use. Forget about working with commands until you use linux for some days. After that, try to learn some basic linux commands. Try using them by entering it in your terminal. You will be amazed to see how responsive and powerful Bash is. When you get familiar with the basic commands, you can tweak it to your own style to fulfill your own needs or you can use the knowledge to modify the existing ones.
Find out FUN...
Let me make it more clear through an example. Imagine that you need to shut down your computer or wake it up at a particular time and perform particular actions like resuming the download of the paused ones. Isn’t that amazing? These are the places where we use shell commands for shell programming. If you find out it power and flexibility by using a few times, then would surely realize that shell scripting is really fun.