1
00:00:00,800 --> 00:00:08,030
In this lecture started with grating script called Get up it's not an age where we will practice handling

2
00:00:08,090 --> 00:00:10,470
of positional parameters.

3
00:00:10,790 --> 00:00:19,760
Let's say that you want parameters A and B with some arguments and parameters c and d without no arguments

4
00:00:20,120 --> 00:00:21,400
without any arguments.

5
00:00:21,440 --> 00:00:31,380
So we need to put call on after a and after B to tell get out that arguments are needed here.

6
00:00:33,300 --> 00:00:43,560
So why get up to command will be through all screwed we'll be executing body of while loop so one time

7
00:00:43,560 --> 00:00:46,340
more after a get up to command.

8
00:00:46,340 --> 00:00:53,380
We are placing positional parameters as parameters A and B require argument.

9
00:00:53,480 --> 00:00:56,870
We need to specify gone after them.

10
00:00:56,870 --> 00:01:01,570
So we see a go on B equal on CB.

11
00:01:01,940 --> 00:01:03,910
After a C or after D.

12
00:01:03,950 --> 00:01:14,130
There is no call on that means that those positional parameters don't need any argument body of a while

13
00:01:14,130 --> 00:01:19,060
loop will be executed when output of a get opts command is through.

14
00:01:19,080 --> 00:01:26,850
That means of an output often get opts command has exit status zero and then all positional parameters

15
00:01:26,940 --> 00:01:32,200
are processed exit status of get up to command is non-zero.

16
00:01:32,730 --> 00:01:39,730
And that means that body of available want won't be processed.

17
00:01:39,820 --> 00:01:45,050
Now we need to ask what is the current parameter to process.

18
00:01:45,130 --> 00:01:48,280
We will check it with case statement

19
00:01:58,020 --> 00:02:10,170
in case the parameter to process is parameter a visual print parameter a barometer

20
00:02:12,510 --> 00:02:16,350
a weight argument

21
00:02:20,170 --> 00:02:23,870
dollar sign up tag

22
00:02:26,800 --> 00:02:31,890
of Arc is variable which has the value of required argument.

23
00:02:31,890 --> 00:02:38,750
Note that the way to get out we didn't check for a parameter starting with the dash get off it handle

24
00:02:38,760 --> 00:02:40,570
this automatically.

25
00:02:40,590 --> 00:02:52,270
So here we didn't check for a positional parameter a dash a but only for a In case B was selected.

26
00:02:52,540 --> 00:02:54,270
We'll print parameter B

27
00:02:59,930 --> 00:03:01,310
parameter B

28
00:03:04,850 --> 00:03:09,750
selected with argument which has value of variable arc

29
00:03:19,380 --> 00:03:20,390
okay.

30
00:03:21,050 --> 00:03:30,510
So in the case Siebel selected we can just print that parameter C was selected.

31
00:03:30,510 --> 00:03:32,040
That is not nothing more

32
00:03:37,650 --> 00:03:46,830
so parameter C selected here remember that we did a news column after parameter C so there is no argument

33
00:03:46,920 --> 00:03:55,050
expected and we can do the same for the parameter.

34
00:03:55,050 --> 00:03:55,380
The

35
00:03:59,920 --> 00:04:06,960
so echo parameter be selected

36
00:04:12,530 --> 00:04:14,190
now the script is done.

37
00:04:14,660 --> 00:04:20,760
We have set what should be done in case specific parameter is selected.

38
00:04:20,840 --> 00:04:24,960
So now the tricky question.

39
00:04:25,070 --> 00:04:31,910
Have you noticed that in the script we are not using keyboard shift for moving away arguments.

40
00:04:32,150 --> 00:04:33,830
We don't need to do that.

41
00:04:33,950 --> 00:04:40,310
Get out in the background has note how many positional parameters of error process and for that specific

42
00:04:40,310 --> 00:04:40,720
reason.

43
00:04:40,730 --> 00:04:46,160
Get ups uses opt in variable we discussed in Del lecture.

44
00:04:46,160 --> 00:04:53,210
This is if I get up it is so easy we don't need to take care of shifting argument if a or is handled

45
00:04:53,240 --> 00:04:54,720
by get opt.

46
00:04:54,830 --> 00:05:01,960
We only need to specify parameters and say what to do when those parameters vary.

47
00:05:01,960 --> 00:05:02,450
Used

48
00:05:06,230 --> 00:05:09,380
we can now just save and exit the script

49
00:05:12,080 --> 00:05:13,640
ground exit permissions

50
00:05:18,680 --> 00:05:21,530
and we can handle it.

51
00:05:21,620 --> 00:05:29,240
Let's say with parameter a wait um argument call required

52
00:05:33,730 --> 00:05:46,810
with parameter B with argument also required and with Dash C D which means both parameters see.

53
00:05:47,200 --> 00:05:57,280
So you'll see that even we put def S.D. it passes both parameters as if we use the C and dash D gate.

54
00:05:57,780 --> 00:06:04,740
Now let's play a little more I can add another a parameter without any argument and we see error message

55
00:06:05,490 --> 00:06:08,110
option requires an argument.

56
00:06:08,110 --> 00:06:16,880
Great now we can both dash DC as a first parameters

57
00:06:20,520 --> 00:06:28,800
and if you hit on it it disperses without any issue you can now play with positional parameters yourself

58
00:06:29,160 --> 00:06:31,770
and I will wait for you in the next lecture.
