Hi, welcome to Learn with Mithiran. So we are going to see the introduction of path 3 of our Linux series, shell scripting. Already I have made two separate videos, one on Linux fundamental commands and another one on how to use regular expressions to find advanced pattern searching along with grep and set command. Suppose you have not seen those videos, I will put down those video links in the description below.
You can have a look into them. So today's agenda is introduction to shell scripting. In our future upcoming videos, we will learn advanced concepts like looping, condition statements etc.
Today we will learn how to write a shell script file, its variables and basic expressions commands. So let's get into the topic. So, all the linux commands we learned in previous classes, I have created a VM in an EC2 machine and installed it in that VM.
But today we are not going to create an EC2 machine, instead of running commands in an EC2 machine, I have my personal Windows machine. So, in this Windows machine, we are going to install and use Linux. How to use it?
It's very easy and it's very simple. So, what you have to do is, you can search for store so if you search microsoft store you will be opening a microsoft store if you have an official windows account suppose if the windows option is not working you can always go to aws create a linux version and install it but today i am going to run a vm vm I am going to run an Ubuntu based machine using a Windows Subsystem for Linux So how do I do it? First, in the search bar, search for Ubuntu There are many official Ubuntu releases In the top left corner, I have already installed it So I am getting installed here What you need to get is, the free button here There is a get button here, you will get the get in So what I am doing is, in Ubuntu, I am going to install a stable version If I click on the get button, then the Ubuntu machine will be installed. For some people, if there is an error without installation, there is a prerequisite. Some machines have enabled this, some machines have not enabled.
We will check it. To install a complete Ubuntu terminal with Windows Subsystem for Linux, WSL, If this is enabled in your machine, this software will work. Let's start the program.
First, I will show you how to enable WSL You can enable it and install it in any order After installing, click on open When you open it for the first time, it will show installing Suppose installation failed Simply you can directly jump and switch to settings Go to settings and search for Turn on off turn on features so turn windows features on and off in the option so if you search for this below you will find windows subsystem for Linux and if you click on tick box and click ok an extra feature will be installed in your machine after that it will ask you for a system restart so restart the system it will be done and after that you can come back to this step you can use ubuntu app you can use this app to run your own machine first you can create a linux machine in your laptop you can run pwd ls command in your own linux machine so again what i am going to do is i am not going to use shell scripting today because shell scripting We are going to write the commands in a file We have a tool, so we are going to use modern tools to run the scripts Modern tool is, I am going to use Visual Studio Code as one of the code editor to write the commands First, I installed WSL, Windows Subsystem for Linux After installing it Second step, I installed Ubuntu app in my Microsoft store. Third step, I don't need this Ubuntu app. I want to run a code editor called Visual Studio Code in my Windows.
Then, the third step is, you can go to your browser and search for something called as Visual Studio Code. If you search for it, you will get the first link officially. If you click on download for Windows, your download should be starting so download and rather start it installation ago so you get already you can I wanna panic right now download an off any gram so let it let that after the download complete meaning other next to next to next install and could be a download installation I write up an app or not fresh up ninja bottle moodle a vessel studio code installation on a pro name open burning now you will be getting a page it should be say boom I have opened my visual studio code Next I am going to open a plugin in Windows Subsystem for Linux To install the plugin, click on extensions in the left hand side It will show you many extensions you will find an extension which is called as WSL if you search WSL on the top you will find WSL related extension and on top of that you will find official tick box if you click on that and click on extension install automatically extension installation will be done so now what we have successfully done is I have installed a windows subsystem step number 1 Step 2, I went to Microsoft store and prepared an Ubuntu app Step 3, I downloaded and installed Visual Studio Code and installed WSL extension in the plugin Now, why all these?
Let's close the Ubuntu app Go to search and search for Ubuntu In this app, code dot so type code dot enter it automatically visual studio code opens so one second it opened but second window is open again let me drag and drop it over here so it opened for me and it will come here so it opened for me and it came here so now what happened is I took a command called code dot let me try doing it again code dot again second window so in a code dot and it should be opening a visual studio code editor and it automatically it will be connected to ubuntu machine so from now on you can run all commands like ls command, pwd, present working directory from your windows machine without using any ec2 machine in your aws account you can run it from your windows so how to run it If you select new terminal, a new terminal will open. I have multiple terminals, I will delete them. A new terminal will be created.
I can go and create a new terminal. Let's see if I have a terminal. You can also select multiple terminals.
If you select new terminal, you can see that there are two terminals on the side. That's why I have already set one terminal and it has opened. Now here, if I run present working directory, Home with Drain, If you run ls command, you will get the files The file system is on the left side All these are starting with dot But all these are hidden files You can see cache, vs code server, bash profile, all these are hidden files That is shown on the side Normally, to create a file, you will need to use a command called touch And give a command called main.sh If you give this, you can see on the side automatically a file named main.sh is created so, even if you create a visual file here or create it manually, both are connected as interlink so, using one of the code editor called visual studio code we are going to see the introduction and fundamentals to shell scripting basics in advanced topics, we are going to see looping functions and if and else we will look into it in a separate video but today we are going to see a very basic and easy introduction class so before the first introduction class Shell scripting is a word.
What does it mean? So what does it mean? We will move on to the practical part. Let us take an example. I will close unnecessary files.
Let us take an example. Suppose I am communicating with a human being. You are my audience.
I am teaching you. Now I am speaking to you in Tamil and English in two languages. So now, you can attend this class only if you understand Tamil and English. If you are watching from North side or from any other states, if you are not aware of Tamil, maybe you can understand what I am saying but mostly it won't be fluent. So I am using a language, only if you understand the language, you can understand the content I am telling you.
That is a restriction. Similarly, I am using a language to communicate with a human. Beyond this, I want to communicate with a computer. I am going to learn special languages.
For example, Python, C, C++, Java, Bash, and PHP, Perl. All of these are one of the programming languages. We communicate using these languages with the computer. One of the languages is Bash. This is very very old and it was created long back If I search for bash So bash was developed in 1989 Even before I was born, in 1989 I got this bash So in 1989 we are learning the command PWD in 2024 That date of recording So now it is a very famous tool, an interactive tool We can talk to our computer If I type a command like pwd, the computer will give me the output.
If I type a command like ls, it will give me the output. So, to speak to the computer, I need a programming language. That is called as Bash.
This is a full form of born-again shell. There are many more like this. Z-shell, K-shell, and Z-assets.
So, if I search for Z-assets, it will be called as OhMyZ-shell. Similarly, if I search for K-assets, it will be called as Con-shell. It is called as Con-shell.
If I search for fish, it will say fish is shell. If all these are shell, it means it is one of the languages to interact with the computer. Because the computer does not understand the language we speak.
Does the computer understand that I speak in Tamil and English? No. What it understands is, how it is configured. All it understands are zeros and ones. So, zeros and ones are what the computer understands.
But if I want to talk to the computer and do a computer job for me, At that time, I am choosing a programming language. That is, Bash is famous. So, I am choosing Bash.
Whether you use SH, ZSH, or KSH, there will be some differences. Most of the commands will be the same. Now, let us see what kind of Bash is available in Linux machine. You can do cat under etc and type shells in the file.
If you open the file, you can see the different types of shell available in the cat. You can use the shell to write commands and show the list of valid login shells. So now what we are going to do is, normally you will run the commands in Linux as ls. Similarly, present working deans run you will type a command and the command will output to you this is the normal you had a relationship something like this but what we are going to do is we are going to use something called shell scripting shell scripting is a concept of waterless we are going to use a file instead of typing a command directly in command line we will prepare a file separately and write the command in that file so after this, each of our instructions will run on the commands in that file for example, I will create a screen and take two commands pwd ls I have these two commands, I manually hit pwd and it got output, I hit ls and it got output I manually hit a command in the console command line Now what I want to do is, I want to write both these commands in a file. I have already created a main.sh file, I am going to write in this First, the first line in your file will be called as shebang s h e b a n g So, first we have to start with shebang In this, mention which shell you are using If I give a path as slash etc shells You can see here, there are multiple shells In this using binbash in the shell, run the command written below that means pwd and ls type it and give ctrl s it will be saved now how to run a script so if i give ls command main.sh is in the file i have written this script in it but i have to run this script to run it, i need running permission or executable permission So what I am doing is, I am adding a command chmod plus x So plus x means, only the permissions that are running, plus means add and x means the executable permissions If you see here, everything will be read, write, read, read But if I give chmod plus x main.sx, you can see Before this, there was no x symbol, but now x is added So what I want is, after this, and you can run this file and the color has changed how to run a file?
sh main.sh if you give like this it will run what is the output of run? the first output of pwd I gave and the second output of ls I gave instead of manually giving pwd and ls I will write it in a file if I run it in a file, all the instructions inside will run one by one so this is shell scripting you It is like an interaction where you take a command and output it. You don't interact like this.
You write the commands in a file. I will run the commands completely. After running it, I will configure the desired changes and output.
For this, we are going to choose shell scripting. I have written pwd and ls. These are very basic commands. After this, we will do is...
we can also write something called as echo so now let me go back to my topic which is echo now give ctrl s save and run the file again but instead of sh i will use./.sh you can use any of the two sh main.sh or./.main.sh So, the echo that I have given in hello world is now being output to hello world So, our first segment is how to configure a Linux box in windows and how to integrate it with visual studio code In visual studio code, we will write a file named main.sh and run basic Linux commands and echo commands in that file I will write echo 1 and paste it multiple times I will write the commands in a file Once I run the file, it will do all its duty This is the first segment which is introduction to how to create a Linux VM on Windows and basic idea on what is a shell scripting Next what we are going to do is how to create a variable and how to assign a value to that variable and how to print it so a variable is for example, if you give a equal to 10 b equal to 20 c equal to 30 this is called a variable how to print this is in echo command if you give a normally what you get is if you give a, it will output a but here we should not give a but give $a if you give now, print that variable then $a means print that variable then I get the value of a similarly print $b $c then I get my 3 output in my result so here what we call a, b, c we are calling it as a variable over here number We use variables to store data There are different types of variables But before that, there are rules and regulations on how to create a variable What are the rules and regulations? Normally, a variable has alphabets and numerical values. But a variable's starting letter should be an alphabet or an underscore. So, your first letter, the first letter of the variable should be an alphabet or it should be an underscore.
After the first letter, you give the number and the values. So, it doesn't matter. give underscore again, give a again, doesn't matter it can be cap letter or small letter, doesn't matter but make sure that your first letter should be underscore or an alphabet second and third letters are consecutive, it can be alphabets, numbers and underscore apart from this, if you use special character, hashtag, exclamation, question mark or any other variable it won't be taken, so make sure you are remembering it so now, another thing, this is not a rule but In shell scripting, we have to follow this rule If you are creating a variable, it should be in all caps Without using small letter, they will use all caps as their variable name This is a norm You can't do this or else you will get an error In shell scripting, everyone will keep their variable names in all capital Remember this So, what I am doing here is var underscore a var underscore b and var underscore c so if we paste these two values and give b and c so as usual, the output is 10, 20, 30 so I have created three variables and assigned a data 10, 20, 30 data instead of 10, 20, 30, you can give a string Hello World, and if you give a set of characters, the data will be outputted as Hello World So, what we have successfully done is, we have seen how to print a variable You can print this in one line only, you can even echo in another line and print it, you will get the same output So, we have seen how to create a variable and how to print the variable along with this we are going to I have told you that there are some types of variables in this variable what are they?
one is local variable another is system variables that is called shell variables another is environment variables we are going to look into what are these in our next segment first what we are going to do is so we did we are going to understand I have created a variable in this variable when you run a process will run so process will run this code I will show an example so I will write echo $age so I will give capital age when I run I will not get any output age is not a variable I will give a comment age is when it is local and search for the variable after hashtag whatever I write is a comment that line is just for our understanding if I give $age I don't have any variable so output is empty in linux we have a concept which is called as environment variable So what I am doing is, I am typing a command called printenv If I type printenv, you can see a big list of environment variables We have shell, colour term, wsl distro, name, present working directory, log name, environment variables This is actually shell variables as well Shell variables are system variables We can use these to create the required data in the system So, we are going to configure age in this variable So, we are going to configure age in this variable So, we are going to configure age in this variable So, we are going to configure age in this variable So, we are going to configure age in this variable So, we are going to configure age in this variable So, we are going to configure age in this variable So, we are going to configure age in this variable So, we are going to configure age in this variable So, we are going to configure age in this variable So, we are going to configure age in this variable So, we are going to configure age in this variable So, we are going to configure age in this variable So, we are going to configure age in this variable Before this, my code didn't give any output. But now, If I run my main.sh command, my age will be 26 So what I will do is, like understandable I will give my age as 26 and run it You can see that my age is 26 and the output will be there So now this is not from local variable, but from environment variable We have picked the age First we will see if it is in local If the code is not in local, it will be seen as a shell variable. If not there, it is not a shell variable. But now it is not in local. So we have seen in the environment variable in the system.
We have to be there. We have taken the data from there and put it here. Now I will do this. Again I will give age equal to 15. Now I will again give echo my ages.
Now you will think, when running this code from the beginning, environment variable second is, if I give age here it doesn't mean that we need to search for it in environment variable since local itself has age, we can take it from there in this line, if local is not there, we can take it from environment variable but if you have a local variable, it will give priority to that So this is an example of how to create a variable and there are many system variables with it So what are the system variables? echo $home echo $user echo $pwd Now run these commands You can see it yourself present working directory home with run If your home directory is home, then user is method Now I am changing the directories I am changing it to cd slash opt After changing the opt, I am changing it to.slash home sh slash home method main.sh Now I am giving You can see that your home directory is home mithran and the user is mithran and currently you are in opt directory So these three commands are already built in in my system We are using that In addition, you can set your own customized variable environment variable age If you set something directly in my file or code We will call it as a local variable So now successfully I have taught you what is a environment variable, what is a local variable and what is a shell variable or system variable So now I will put it as shell variables So now I have given shell variables So now successfully we understood what is a variable, what is a local variable and what is a shell variable How and where to use it, depending on the scenario we can choose one over another So far I have given only echo command and printing the data Beyond this I can also use something called read So the read command is when the user is going to input something from the console If I am going to read the input, then we can use read so let me erase this content and erase and say echo what is your name I will give read and I will be putting variable my name echo hey nice to meet you dollar my name Done. So now I have written three lines.
You have used the command echo echo for a long time. That is because it shows the print statement, the output. Whatever you have written, it will show in the output.
But now I have written a new data called read. This is because the user will give an input from the console. What I have to do is capture that input, store it in the data and read it to me.
This means that it will store it in my name. Next time you can use it in echo again. Now I am going to go to my home directory and clear the screen and run this script again.
Let us see what happens. So if I type./.main.isSection, it will ask what is your name and I didn't give your name. So I will enter my name as Mithran and it will say hey nice to meet you Mithran.
So I will enter your name as your. So what we will do is, we will take a message in echo command and it will come. After that I will go to read command and read it. In the shortcut command, you can use a shortcut.
For example, read-r. here copy and paste this message now we don't need this echo command now if I give main.sx your name is not a valid identifier ok so let me check out my read command read-r now let's run this so now what happens is that it is successful so I did what If I give a main.sh, it will ask what is your name So there is no need to give a separate echo command If I want to directly send the input, it will store it in my name If I enter, it will say hey nice to meet you and I am getting an output Suppose we are giving a name, if I want to send that name, it will store it in a variable and print out the result So now in the read command, you can give an input of"-p", This is a separate echo command and read command. In one line, you can print this message as a shortcut. Now, we have seen what is read.
Next, we are going to learn some command line arguments. I have a separate PPT. In this separate PPT, I have explained what are variables.
Variables means, a variable stores a value. But we have a concept called as special variables. Special variables are extremely important.
In interviews, they ask about dollar zero, dollar one, dollar hash, dollar question mark. I will give this in high level priority. Whatever you are seeing in this page, make sure you are remembering this.
So let's go. So, if I show you an example of all these, it will be better for you to understand also. So, what we are going to do is, I am writing a script. I am running the script by saying main.assertion.
Now, normally you can pass an input to a script. How? By using read.
That is option number 1. There is another option. So, how do we pass that? Instead of passing the output in a read command, we will be passing it through command line that means, here i have main dot assets with these main dot assets, i can pass an input if i pass, i can give input as mithran 26 so i am giving input in my first time file, because i am running that file next time i am giving input, you can give any input, different or different so now i am writing echo hello here if i run this, it will output as hello so where is this mithran26 i have given it as input we are going to store it in the form of special variables special variables are n first $0 $n i will give a very simple command echo the value of $0 is $0 is going to print as $0 I am giving $0 as the value is or else I am giving file name as $0 $0 means file name of the current script sorry, current script if I run it you can see here the file name is dot main.sh but dollar zero represents the first position in the main.sh and so in the next position, it will be dollar one so if i give dollar one and my name is now i will get the output of mithran but similarly if i say dollar two in my ages Now if I run, my age is 26 $0 is the first file name 1234 and so on If you are passing any input arguments, you can use these numbers to cap set them Now, there is a $hash command What is that? It is very simple Now, I will do it here I have given a $hash command and instead of age, if I give the number of arguments passed are How many arguments have you given?
Mithran and 26, have you given two? Then it will be 2 If I give Mithran 26 and 88 You have given 3 inputs 3 arguments Then $hash is the number of arguments passed $star and $8 will be combined in one line All the arguments are For example All the arguments are or star and at Now if I run this, you can see here all the arguments are I have given Mithran 2688 all three are coming here So what is the difference between and When will it be used? In future topics, we will learn loop concept we will use this symbol in the loop for now we are just understanding what is this symbol so nothing fancy, nothing complicated now we have seen dollar star and dollar at dollar question mark is very famous because i have run a script before if you want to check if the script is success or failure if you give dollar question mark we will get echo dollar question mark If I give 127, it will say 127 which is the previous run command failure. Now I will give main.sh../.main.sh Successfully run. Now if I give It will say 0. I made a mistake without knowing.
So I made a mistake with Command not found. If I give echo There is an error message 127 Here the exit status of the last command executed Before that the command I run is a success or failure To check the exit status Normally, any number except 0 means failure If I give Exit status is a problem 127 is the number What I do? I successfully run the code There is no error in the run code dollar question mark means that the code I have run before has been successfully completed dollar dollar means that the bash is running in the process id the process number of the current shell for shell scripts this is the process id in which they are executing and this To know what process is executed in this, you can use is the process number of the last run command Now I am opening the task manager This is my system's task manager I am using 24% of memory, 9% and 8% CPU Since I am recording this, I have an amount of GPU encoding it is also working my GPU is also working you can see here there is a lot of process running if I want to start a new process let me use calculator when I open calculator I get new calculator and to run it I get extra mb and configuration when I close calculator it will go from here and my memory will be free similarly what I am doing is If you run the script, a process will be sent to the memory table.
The process will be free from the memory table when the script is put. Similarly, if you want to know the number of the process run last, you can use Since I did not run the script, I did not get that number. Suppose I run this as main.assets and now I give Still, it is not a Linux machine. Since I am using it in my Windows machine, it is task manager. Since the process number is different, just know this.
This is the process number of the last background command. So, if you want to run a script directly in the foreground, you can do it in the background. So, if you want to run a script directly in the background, you can do it in the background. So, if you want to run a script directly in the background, you can do it in the background.
We will see that in future topics. If you want to see the process number of the command running in the background, you can use that number. So, we have successfully learned what special variables are.
So, in today's class, we will see what is a variable and what is a special variable. How to use read to get input from the user and store it in a variable. How to print the variable. This is our main agenda. I have some operators with me.
Very simple operators. Those operators are in my PPT. you can have a look into this in operators, I will show you how to run them and what will be the output operators are symbols symbols means each symbol has a requirement so I will take some basic symbols and paste them in my script, I have created two variables a equal to 10 and b equal to 20 First I will print the value of these two variables The value of A is $A and the value of B is $B So I will get 10 and 20 Now, expression, normally in other languages if you give a plus b directly a and b will be added and 10 plus 20 will be 13, but not in bash In bash you have to give expr which stands for expression You have to explicitly mention that you want to run this expression Along with that, I have a symbol here This is called back tick You would have used single quotation and double quotation But this is called back tick Back tick is the escape button on your keyboard So if you press the function key and press the escape button, the back tick will be dropped. So what you are going to do is, you are going to give a back tick at the starting and then the expression a plus b, a minus b.
a multiply b, but it will not work if you give a star directly, it will be backslash because it is a escape sequence. a multiply b, b divided by n, b modulus of a. If we run this, we will get an answer. I will tell you what happens if we use that answer. So, if I give the symbol as the number cent, then no.
Directly, main dot assets will be run in foreground. So, when I give the main dot assets, the value of A is 10 and the value of B is 20. A plus B is 20. A minus B is minus 10. A into B is 20 into 10 is 200. B divided by A. If we divide 20 by 10, the answer is 2. quotient is 2. We have said reminder.
What is reminder? For example, I am going to divide a number by something. So, if I ask you to divide in pen and paper, you will write a number like this.
So, I will say 17 divided by 3. So, you will say 3 5s are 15 and you will give me 2 as the remainder. so this 5 is quotient and 2 is reminder similarly, if I give 17 here and 3 here if I give, when I divide quotient will come and when I model this will come reminder will come save and run, now as I drew in the paint diagram, my quotient is 5 and when I divide 17 suddenly, it will come reminder 2 successfully, this is Arithmetic operator is used to perform a mathematical operation We also have assignment operator equal to I will simply give a equal to $b What will be the value of b stored in a? If I print A and B again, you can see it yourself. Initially, the value of a is 3 and b is 17. Now, the value of a and b are the same. So, it is an assignment operator.
You can also check with it. Suppose, if a and b are the same number, return true. If a and b are different, return false.
In our situation, when I do this, I will go to my script and do this. syntax will be a little new just keep this in mind if and else topic we will take in next class then what i will do is i will tell the meaning of square bracket dollar a is double equal to dollar b if i run it, a and b are same now both are 17 and 17 So if I run, I will get the output as 1. True. Now I have taken this value. Now what will be the value of a and b?
3 and 17. They are not equal, so it is false. So what is w equal? It means that both values are same. Not equal means that both values are not equal.
So when you run, a and b are same or false? a and b are different? Yes, true.
So I get 0 and 1. true or false is the output successfully we have seen the arithmetic operators apart from arithmetic operators we also have relational operators relational operators are greater than, less than, equal to, not equal to, greater than or equal to, less than or equal to all these are even if you have a normal knowledge computer science background you will get to know it suppose if you have some electricals you will know these greater than less than so greater than, greater than or equal to, less than, less than or equal to, then equal to and not equal to so to compare two things and say true or false we can use this relational operators but A is equal to B VA is not equal to B, NE is not equal, EQ is equal, GD is greater than, LT is lesser than, GE is greater than or equal to, LE is lesser than or equal to. So, here we have examples, description, using this, we can compare two things and say true or false, we can use this relational operator. So, in arithmetic, we used expression and saw addition and subtraction.
In relational, same. EQ, NE is the example of relation operator Similarly, there is a string operator String operator is given by saying yes or no We will use this in the next topic in the class if and else We will compare this and then you will understand what it is But for now, we are getting it by comparing two things Suppose I have two strings If there are two strings, for example, let us say a is equal to abc, b is equal to xyz. Now I have two strings.
If these two string values are the same, I will be getting true. If they are different, I will be getting false. So this is string operator.
You can compare between two strings. This is also called as ZN string. So Z means if the given string operand size is 0, if it is 0 length then it returns true.
We need to see the size of the string. What is the size? Is it bigger than 0 or smaller than 0?
So check if the given string operand size is 0 or not. Z is 0. To check if the string is empty or not, you can use this syntax by giving"-z". If there is any data inside, it will be false Similarly, if the given string operand size is non-zero, then check if the given string operand size is non-zero If the string is non-zero, then the string should not be empty So, it is very simple.
Let me tell you what that means if you are not able to understand Now, I am giving this expression. We use this expression mostly in if condition, that is why I did not use echo Now, I have a string with a data. So, the output is false.
If this is an empty string, the output is true. Because, it checks the statement, Is my string zero? It is zero now, right? If there is any data inside, is the string zero?
No. Then false. The opposite is, check if the given string is non-zero.
And finally, check if the string is not empty string. If it is empty, then returns false. To compare the size, we can directly say z and n and str.
If you mention the string without mentioning the N and Z, the string will pass only if the condition is there. Otherwise, it will fail. So, we successfully understood what is a string operator.
I will show all these with examples in the topic of if and else. You will get a better idea and an example. Finally, we have file operators.
To memorize file operators, There are 5 slides in this file. Each of these 5 slides are extremely important for your shell scripting. In file operator, Ifen D is to check if the file is a directory or not. All are true or false. Ifen F is to check if it is a file.
Ifen R is to check if you can read the file. Ifen W is to check if you can write the file. Ifen X is to check if you can run the file.
and check all these and return as true or false and similarly if the file size is bigger than 0 if the file is not empty and there is some data inside at that time if you use"-sn", check if the file size is greater than 0 if it is bigger than 0, it is true or false similarly,"-e", is to check if the file is there or not exist or not if it is exist, the condition is true and the file is not there and if we refer to an empty file it will be false the"-e file is not the only file you can check the directory as well so with this we will wrap up our today's class what we have done is today's topics are how to install Linux in windows and variables, special variables and read data and we have seen some operators so in our next separate video I'll teach you how to make conditions and how do you create loops on a separate topic. Thanks for watching till the end. So in the Linux series, we have seen shell scripting part 1. So in these separate parts, we will learn loops, if and else, we will see some advanced topics. So since it's completely free content, I hope you like our today's video. If you like what I'm teaching and If this is useful for your friends, do share the link to them. And also, as usual, do like and subscribe to Learn With Mitran.