In this lecture we're going to use a in our script and I will show you what we've built.
Firstly I wrote the content of my directory where I have few text files and now I relied on the script
at a dot s h
discrete stores in a names of all text files and then iterate through aere and for each text file it
brings in two square brackets information.
What is the line of that file name and also information.
If we have permission to write into that file so I will now remove the script and create new
on the first line.
I will start with shoving Dana Bash then into the the.
Video store.
All text files names and even use command.
As for that
but as if you are using our command for every assignment we need to come on substitution so we can do
that by prepending dollar sign and before anti-seize which contains our common
because we will be looking for a it will be nice to have some Guntur so we can identify what index we
are processing right now.
And we will start with Guntur which has the values 0 0 index in a means first item.
Now we can loop through array.
So for a file in a in all items
and I am using at symbol for death in square brackets.
So for each file we will do some commands and we will do that between do and damn keyboard.
So we can print Firstly filename
and then into firebrick it gets
so into that square brackets we can write its name length and we will do that using an 8 index as we
are practicing all about at now.
So in the square brackets we are putting value of variable count so here into curly brackets we are
starting with Esch then at a and then into square brackets we are placing
output a viable count and it represents a index.
Now we can bring in if that file is a writer or not.
So we are asking if that file is a writer.
And for that if we are of course using and.
And if that file is of writing go we'll put in
top followed by string.
Yes.
And because of the special character we need to use eco dash.
And if the file is not right or wrong we will print up for it by saying no.
Now we can also increment a counter and basically
if we do then we are done we create.
So now we can say that
now Grant exec what permissions and around the script
great.
It is working.
But to be sure that it is really working.
I will remove the right permissions from file introduced text
and now after running discreate we see dead file in the text is not the right level.
Great but it seems to hit.
I forgot to do a header so I opened the script again
and after assignment of Redbook count
right equal with parameter even because the values stop and write filename backslash the represent stop
right there.
Bill and save the script now and then again and Gray Davis see the script US-Soviet the heater output
of the data.
It works perfectly.