1
00:00:01,550 --> 00:00:10,790
So let's start building our ascript create file spaces not as page and started with siobhán on the first

2
00:00:10,790 --> 00:00:23,100
line and then on an other line we can write comment about how to use our script so we can use barometer

3
00:00:23,120 --> 00:00:24,050
or filed out

4
00:00:27,960 --> 00:00:34,680
barometer Desch or dash dash fix for fixing the issues.

5
00:00:37,980 --> 00:00:48,030
And we can also use barometers dash age or Dish dish help for displaying health information.

6
00:00:48,170 --> 00:00:54,380
So in order to have script working we need at least 1 argument file apart or help.

7
00:00:54,380 --> 00:01:01,810
So if there is no argument we can bring to user usage message and exit descript.

8
00:01:01,830 --> 00:01:06,830
So if a number of arguments is equal to zero

9
00:01:10,100 --> 00:01:13,680
we can print usage message to user.

10
00:01:14,150 --> 00:01:16,110
So we are calling function.

11
00:01:16,120 --> 00:01:16,840
Who is it

12
00:01:20,150 --> 00:01:26,050
then in order to know what parameters to use that has chosen we need to loop through them.

13
00:01:26,050 --> 00:01:37,750
So while a number of arguments is greater than zero we've heard from commands between two and done keyboards

14
00:01:39,690 --> 00:01:42,750
and now we can check what is the first argument.

15
00:01:42,760 --> 00:01:50,620
So if a woman is Desch a have all the dash dash figues

16
00:01:56,640 --> 00:02:04,110
we can for now just throw away that first argument which will make second argument the first of an

17
00:02:08,780 --> 00:02:14,240
IF first a woman is denge age or dash dash and

18
00:02:20,300 --> 00:02:23,490
we can print usage message to user.

19
00:02:23,750 --> 00:02:33,680
So we are using functionally use each for that and then we can throw a first our will and then we would

20
00:02:33,680 --> 00:02:37,330
like to ask if user has specified file path.

21
00:02:37,580 --> 00:02:44,600
And since this option has no Paromita are such a file we just ask for a debt in US there is a section

22
00:02:44,870 --> 00:02:49,250
which contains any other not specified arguments of values.

23
00:02:49,370 --> 00:02:52,520
So if the first argument is a regular file

24
00:03:03,560 --> 00:03:09,830
we can assign to variable court file value of first argument

25
00:03:15,890 --> 00:03:20,200
and we can throw away that argument immediately.

26
00:03:20,300 --> 00:03:35,550
And if that first argument Vasa not Eric rafał then we can just put to two hours how to use our script.

27
00:03:35,780 --> 00:03:39,580
And this is basic structure for reading arguments.

28
00:03:39,620 --> 00:03:50,710
We can now close case section using Issaq keyword.

29
00:03:50,920 --> 00:03:55,930
So now before we test that we can also write that use it function

30
00:04:07,310 --> 00:04:14,660
so function use each and inside function body.

31
00:04:14,660 --> 00:04:16,010
Right.

32
00:04:16,070 --> 00:04:19,200
You can use it.

33
00:04:20,090 --> 00:04:29,480
Don't assign 0 which represents our script name then use it in the news that can use file but also can

34
00:04:29,480 --> 00:04:34,250
be use Desch or fix.

35
00:04:34,970 --> 00:04:40,250
And also the user can use dash age or does dash help for help information

36
00:04:43,610 --> 00:04:46,120
we can't exit with status one here.

37
00:04:46,250 --> 00:04:51,080
So when the user ends here there is no possibility to continue with our script.

38
00:04:53,170 --> 00:04:56,550
So we can save the script and do some quick this thing.

39
00:04:56,570 --> 00:05:00,170
If our structure for reading I woman's work so well

40
00:05:05,860 --> 00:05:07,520
grant executive permissions

41
00:05:12,240 --> 00:05:15,350
and run our script with some file location

42
00:05:22,710 --> 00:05:24,640
and I got no output which is good.

43
00:05:24,640 --> 00:05:30,610
Now if I specify the f parameter I have also no output printed.

44
00:05:30,840 --> 00:05:37,610
But if I change that to something not existing I got a usage message.

45
00:05:37,680 --> 00:05:41,840
So great and this works perfectly parameter.

46
00:05:41,930 --> 00:05:47,670
Does this help should also Brind message and it does.

47
00:05:47,670 --> 00:05:50,050
I can also remove file alligation

48
00:05:55,140 --> 00:05:58,960
and usage message is present also which is good.

49
00:05:59,370 --> 00:06:04,560
So in next lecture we can add some more functionality to our script.
