Linux - Shell quoting mechanism
12K views
Nov 28, 2024
Linux - Shell quoting mechanism
View Video Transcript
0:00
Now here we are going to talk about the shell coating mechanism
0:04
Now what is coating mechanism? Like the name itself, we are going to quote something, we are going to hide something
0:10
So in most of the program sometimes it happens we do not want some output of particular command or instructions written into the program
0:18
Or we do not want its display to be viewed to the user or the program runners
0:22
So for that, we can hide this particular shell instruction from anywhere
0:27
So let us see how we can use this quotation. use this quotation mechanism or coating mechanism. Now if I'm talking about the shell
0:33
coating mechanism, this shell coating provides the hidden characters or we can say
0:38
it hides the characters which we have written into the program. It treats any
0:43
particular number or character from the command line as your metadata. So whatever
0:48
the data generally you have written, it will treat all the numbers and all the
0:52
characters you have written as a metadata of that program or the shell. Coating is
0:58
generally a general term given to your action protection of your meta characters what
1:03
the action we are going to process on it the same thing it will be treated especially by
1:08
the shell or we can say it is treated specially as a special character by this particular
1:14
quotation mechanism just by hiding it by backslash or a quotes so we can use the codes or following any particular command following with your backslash so that we can hide it from the program
1:27
Let us see which are the quotes we can use. We can use single code
1:33
We can use double quotes. We can use backslash or you can use your back quotes
1:38
So in this way as your program you have written or the characters you have written
1:42
just you need to define the backcode. Same way you can define the back
1:46
same way, single code, double quote or double backslash so that we can hide any particular character or the number from the program or any instructions from the program
1:57
So let us see how we can hide a particular command or particular instructions from our existing program into our terminal
2:04
So most of the characters which we have seen into these slides generally provide you various meta character and which has a special meaning which we can use for, you know
2:16
hiding a particular termination of a particular word or a particular text or a particular command into our scripts
2:23
Now what happens sometimes like if suppose I'm defining hello and semicolon that is the end symbol and word
2:33
So what your command will do Echo will print the hello and it will come to know that here we have ended it And the hello is some other command and it is finding for this command and it doesn get it
2:52
So if I want to print the same, I can do this, I can give it in such a way, hello, backslash, semicolon and the next word
3:04
That is accepting it, right? either we generally use we have used it many times either we can use for use the double
3:14
codes again it will list it so what we are doing we are hiding this special character
3:21
which we generally use that is semicolon for terminating a particular common even we
3:28
can use a single codes over here for printing the same right so this all this
3:36
all your backslash, your double quotes, your single quotes work as the same
3:42
Same way if suppose I want to print something like, you know, I want to print some
3:48
page or I want to print some of my data like or any kind of numbers using the non-variable
3:57
characters but still I want to define dollar like an example I can say hello I have
4:11
So if I use in double quotes it will accept. But if I use in such a way, so what it will do
4:21
It won't prompt me for this, right? It's accepting this as a different variable
4:27
So if I want to print this, again, what I can do? Again, what I can do is I have slash which will be hiding this
4:37
vector and you can see now it is printed. So this is the different useful methods generally which we use that is a backslash, single
4:46
code, double codes so that we can hide some characters and we can avoid the termination
4:51
of our command due to some special characters used into the command itself
4:57
So this is the way generally we can hide a particular command and we can use this into the shell. So this is what exactly we have
5:05
into the, you know, how we can hide a particular termination or particular special characters
5:11
by using this code, single quote, double backslash and your slashes. So into next video
5:19
we are going to talk about some functions which we can create into the shell. So let us begin
5:24
with that into next video
#Programming
#Scripting Languages
#Software