1
00:00:01,630 --> 00:00:07,690
In this lecture we're going to use a in our script and I will show you what we've built.

2
00:00:07,710 --> 00:00:17,550
Firstly I wrote the content of my directory where I have few text files and now I relied on the script

3
00:00:17,640 --> 00:00:19,590
at a dot s h

4
00:00:23,640 --> 00:00:32,490
discrete stores in a names of all text files and then iterate through aere and for each text file it

5
00:00:32,490 --> 00:00:35,180
brings in two square brackets information.

6
00:00:35,180 --> 00:00:39,800
What is the line of that file name and also information.

7
00:00:39,840 --> 00:00:49,010
If we have permission to write into that file so I will now remove the script and create new

8
00:00:55,260 --> 00:00:56,220
on the first line.

9
00:00:56,220 --> 00:01:05,550
I will start with shoving Dana Bash then into the the.

10
00:01:09,600 --> 00:01:10,380
Video store.

11
00:01:10,440 --> 00:01:13,640
All text files names and even use command.

12
00:01:13,710 --> 00:01:14,440
As for that

13
00:01:22,120 --> 00:01:28,960
but as if you are using our command for every assignment we need to come on substitution so we can do

14
00:01:28,960 --> 00:01:34,220
that by prepending dollar sign and before anti-seize which contains our common

15
00:01:37,220 --> 00:01:46,550
because we will be looking for a it will be nice to have some Guntur so we can identify what index we

16
00:01:46,550 --> 00:01:48,240
are processing right now.

17
00:01:50,240 --> 00:02:00,950
And we will start with Guntur which has the values 0 0 index in a means first item.

18
00:02:00,960 --> 00:02:03,590
Now we can loop through array.

19
00:02:03,660 --> 00:02:08,910
So for a file in a in all items

20
00:02:18,670 --> 00:02:26,570
and I am using at symbol for death in square brackets.

21
00:02:26,640 --> 00:02:36,140
So for each file we will do some commands and we will do that between do and damn keyboard.

22
00:02:39,520 --> 00:02:43,140
So we can print Firstly filename

23
00:02:46,710 --> 00:02:49,650
and then into firebrick it gets

24
00:03:03,820 --> 00:03:12,820
so into that square brackets we can write its name length and we will do that using an 8 index as we

25
00:03:12,820 --> 00:03:14,900
are practicing all about at now.

26
00:03:15,040 --> 00:03:23,030
So in the square brackets we are putting value of variable count so here into curly brackets we are

27
00:03:23,030 --> 00:03:34,830
starting with Esch then at a and then into square brackets we are placing

28
00:03:37,320 --> 00:03:49,390
output a viable count and it represents a index.

29
00:03:49,600 --> 00:03:55,280
Now we can bring in if that file is a writer or not.

30
00:03:55,280 --> 00:03:58,420
So we are asking if that file is a writer.

31
00:04:02,000 --> 00:04:05,980
And for that if we are of course using and.

32
00:04:06,710 --> 00:04:12,830
And if that file is of writing go we'll put in

33
00:04:19,220 --> 00:04:22,090
top followed by string.

34
00:04:22,220 --> 00:04:24,220
Yes.

35
00:04:24,220 --> 00:04:29,830
And because of the special character we need to use eco dash.

36
00:04:31,040 --> 00:04:39,930
And if the file is not right or wrong we will print up for it by saying no.

37
00:04:40,280 --> 00:04:44,960
Now we can also increment a counter and basically

38
00:04:47,970 --> 00:04:54,010
if we do then we are done we create.

39
00:04:54,190 --> 00:04:56,930
So now we can say that

40
00:05:01,690 --> 00:05:06,970
now Grant exec what permissions and around the script

41
00:05:10,500 --> 00:05:11,310
great.

42
00:05:11,350 --> 00:05:12,400
It is working.

43
00:05:12,580 --> 00:05:15,470
But to be sure that it is really working.

44
00:05:15,490 --> 00:05:20,770
I will remove the right permissions from file introduced text

45
00:05:26,230 --> 00:05:32,790
and now after running discreate we see dead file in the text is not the right level.

46
00:05:32,890 --> 00:05:36,650
Great but it seems to hit.

47
00:05:36,700 --> 00:05:42,400
I forgot to do a header so I opened the script again

48
00:05:45,990 --> 00:05:48,900
and after assignment of Redbook count

49
00:05:51,390 --> 00:06:05,870
right equal with parameter even because the values stop and write filename backslash the represent stop

50
00:06:06,950 --> 00:06:07,470
right there.

51
00:06:07,480 --> 00:06:18,820
Bill and save the script now and then again and Gray Davis see the script US-Soviet the heater output

52
00:06:18,820 --> 00:06:19,720
of the data.

53
00:06:19,900 --> 00:06:20,830
It works perfectly.
