1
00:00:01,810 --> 00:00:04,100
How is divine loop constructed.

2
00:00:06,690 --> 00:00:14,460
We can see that the construct tests for their condition at the top of a loop and it keeps looping.

3
00:00:14,460 --> 00:00:23,510
As long as that condition is true that means as long as the exit status of condition returns zero.

4
00:00:23,700 --> 00:00:31,300
Usually we are using dialup in cases it's the number of Roop repetitions is not known beforehand.

5
00:00:32,940 --> 00:00:40,480
Now we can see an example of a vial which is really stupid but easy to explain in that condition.

6
00:00:40,500 --> 00:00:46,370
We are asking if a name variable is different from saying stop.

7
00:00:46,370 --> 00:00:55,260
If yes then the existence of those test square brackets of that condition is zero.

8
00:00:55,260 --> 00:01:00,640
That means that the script will execute commands between do and damn keyboards.

9
00:01:00,930 --> 00:01:08,940
So it will ask you for your name and assign to a variable name and then the loop is done and we are

10
00:01:08,940 --> 00:01:10,650
starting from the beginning.

11
00:01:10,860 --> 00:01:15,640
We didn't condition is your name different from stop.

12
00:01:15,740 --> 00:01:17,530
If yes continue it.

13
00:01:17,530 --> 00:01:19,350
Body of vital.

14
00:01:19,970 --> 00:01:27,920
So you will be looping till you enter stop as if we have C-style for you.

15
00:01:28,110 --> 00:01:30,880
We also have C-style a while loop.

16
00:01:30,990 --> 00:01:37,530
Here we are of writing condition into double parentheses and vote is important to mention inside the

17
00:01:37,530 --> 00:01:38,810
double parentheses.

18
00:01:38,820 --> 00:01:42,820
You cannot use dollar sign symbol using variable.

19
00:01:42,870 --> 00:01:43,780
It is similar.

20
00:01:43,800 --> 00:01:46,210
As for command a lot.

21
00:01:46,740 --> 00:01:54,900
In the example of the C condition variable A is less than how they meant create file an income and value

22
00:01:54,960 --> 00:02:01,230
of variable a so this code vote create nine files for us.

23
00:02:01,490 --> 00:02:09,480
If it out to that condition equal sign that means if a variable A is less or equal to limit then the

24
00:02:09,480 --> 00:02:13,670
code would create 10 files.

25
00:02:13,680 --> 00:02:19,190
One of the most common usage of a WHILE loop is for reading files.

26
00:02:19,260 --> 00:02:21,320
The structure is following.

27
00:02:21,660 --> 00:02:31,680
We are starting to violate followed by variable which represents one line from the file between do and

28
00:02:31,940 --> 00:02:32,910
keyboard.

29
00:02:33,090 --> 00:02:42,240
We specify what we want to do with deadline and now what is most important After down damn keyboard.

30
00:02:42,550 --> 00:02:50,770
We need to specify what file will be used as a source for standart input of a while loop.

31
00:02:50,770 --> 00:02:58,300
So basically we are redirecting file into Vinal loop standart input.

32
00:02:58,310 --> 00:03:07,310
We can also read the file line by line using another method or supply file as a standard input to while

33
00:03:07,310 --> 00:03:10,420
loop using pipe.

34
00:03:10,960 --> 00:03:17,590
If you want to write to screen line by line we would do that in the following way.

35
00:03:19,420 --> 00:03:21,250
So we have discussed already.

36
00:03:21,430 --> 00:03:25,100
So let's write some script to see it in action.
