 Hello and welcome, everyone. In this video, we'll be discussing about shell scripting. So by the end of this video, students will be able to execute basic shell scripts by using the basic UNIX environment. So here is the outline of this video. Basically, we'll be going through what is shell scripting and a couple of definitions. And this will be followed by examples. So it would be a good time now to recall what is meant by a simple computer program. So as we all are aware, that generally a computer program is nothing but a set of code or a piece of code written in any programming language, like either a C program or Java or Python, which is later on converted into a machine code by using some sort of compilers and interpreters. And it looks something like this, as you're able to see on the screen. So generally, the computer asks you, tell me what to do. And then whatever program that you might have written and later on converted into a machine code in the form of 1s and 0s that is transferred onto your machine in a language where your computers can understand. And then the computer decides what is to be done. So with this perspective kept in mind, it is going to become very much easy for us to discuss what is shell scripting. So before entering into the details, let us have a look at a simple program, a simple C program which prints hello world to the screen. So this is how a simple C program looks, which is converted into this one zero machine code by the help of compiler or interpreter. And then that is transferred onto the machine and then machine is capable to understand what are the jobs that it is assigned and what needs to be done in the form of a desired task. Well, let us get started with the basic block diagram of Unix system. So as you're able to see on the screen, basically we have hardware here. The PC or the computer or the CPU, which we have seen earlier in the previous slide, is going to rely somewhere here under the hardware block, which is overlapped by something known as a kernel. So kernel is nothing but the core of this particular, what we can call an operating system. So hardware is overlapped by a kernel. So this kernel is nothing but a sort of software layer, which is installed onto your hardware and which is then controlled by another layer called shell. So as you can see, there are a variety of shell available in the Unix environment. So we will be generally calling it a shell. So shell will be acting as a bridge between the outer application layer and the inner hardware layer. So this is the drop structure, like we have level number one, two, three and four. So level number one is the core hardware, like maybe a CPU or some sort of PC on which we're installing an operating system. So the operating system has kernel, which has a direct linkage with the hardware. And then this kernel can be communicating with applications like either maybe our Gmail or it would be an FTP server or it would be any word or a text editor. So these text editors are nothing but those are the application layers which can be generally accessed by the users. So keeping this architecture or so-called the block diagram of a Unix operating system, we will proceed ahead and look at the various types of shell scripting. So what is shell scripting? Shell scripting is basically a computer program designed to run by Linux-based systems, which could be of one of the four types of shells. The first one is born shell. The second one is C shell. Third one is a coin shell and the last one is a GNU born again shell. So depending upon what kind of command line interface you're using and what kind of operating system you're using, it depends like which shell is going to be native to that particular operating system. So the things will become more clear when we get into the demonstration. So here are the four basic components. So here are the basic components of a shell scripting example. So as you can see, the first line is generally known as a shebang which always starts with a hash sign followed by an exclamatory and then the path to that particular shell. So here we have the first slash after that hash and exclamatory, the first slash actually represents the root folder of a Linux operating system or so-called the kernel, which we have seen in the block diagram. Then under bin folder, we have the type of the shell. So if we are using a coin shell, probably this would have been like KSH. So currently this is a sort of general bond shell so because of which we have considered writing SH here. So this is the first shebang code which forms the first line of every shell scripting program. Now, next to that, we have a couple of Linux commands where the first line is actually trying to remove forcefully with a argument called minus F, a kind of folder, I mean a kind of a file called slash temp slash listing.temp. So it is simply trying to forcefully remove this particular path by pushing it to some other position. So similarly, touch is another command which generates or creates a text file or simply a file. So currently under temp folder, a file named listing.temp is created with the help of a command called touch. So you can simply write the list of commands which generally your Linux terminal supports. So as we already seen, a shell script is nothing but a list of programs. The reason why we have discussed about C program earlier is that even a C program looks like this. Like you define a couple of header files, then you include some of the variables and then you do some stuff which is going to print something to the screen. So depending upon all these things, we decide what commands needs to be done. So it's a sort of automation in Linux operating system. So removing a file, deleting a file or maybe creating some thousand files or maybe searching for a single variable or a command in a given list of complete folder which contains some thousands of files. So all these kind of activities which can't be done through the UI interface is simplified. So generally shell scripts are used for automating some complex jobs or some repetitive jobs which is an important aspect. The second part is where whenever you want to comment a certain line in a shell scripting program, you need to write a hash. So it's a very simple thing. So whenever you are about to write or make your program a little bit more simpler or complex, then you generally try to add some sort of comments to your program just to make it more readable. So similarly, similar to your C, C++, Java, HTML and other programs, even shell scripting supports commenting certain lines for proper readability of the code. So along with that, whatever commands you want to put that can be simply be listed in your shell scripting file. And then you can name it with a name called some filename.sh. So here the name extension for your shell command or the shell file needs to be .sh. So here I have logged in into the Ubuntu operating system. As of making this video, I'm using 18.04 Ubuntu version and the first task that generally we need to perform before executing any sort of shell script is just go to terminal and open it. So the window which you're able to see here is referred as terminal in Linux operating system. So I'll maximize this. So here what you are able to see is that I have logged in with a username called root one and the name of the operating system that was given at the time of installation was Ubuntu. So let me first of all introduce you with a couple of basic tasks that we need to generally perform whenever you are about to work with a Linux environment. So the first task is when you're not sure that admin password is not set. So this is something like you are just a guest appearing so this is like you generally log in by default with the help of a guest privilege and whenever you want to change some sort of system roles or maybe some sort of maybe changing the time or you want to get a very good access to the internal kernel related operating systems or maybe if you want to access the system files it is mandatory that you need to have some root access. So to gain the root access the command that we use is SU but if you have a root password which is already set then you can directly hit this command called SU which stands for super user and then it will prompt for a password and then whichever is applicable that you are supposed to type and then as you can see on the screen I have currently access as a root of my operating system and currently I'm in home slash root one. So in case if I'm not having or in case if I didn't set any root password then the command that I need to set is sudo pass wd which stands for setting up a root password. So it will prompt me to enter the guest password then currently it is asking me to enter some new password for admin. So I'm typing it twice it will definitely go for confirmation. Now let me check whether it is updated or not I'm typing my new password and yes I have successfully logged in as root. Here are the references used for this particular video. Thank you.