1
00:00:00,740 --> 00:00:08,400
For a mathematical comparison we can use several operands as equal to not equal to greater than or less

2
00:00:08,400 --> 00:00:13,060
than greater than or equal to less than or equal to.

3
00:00:13,460 --> 00:00:16,850
But how to use them in each state run.

4
00:00:16,890 --> 00:00:18,630
Here are some examples.

5
00:00:18,780 --> 00:00:26,200
In the first we are asking if the value of variables is equal to 5 in the second example.

6
00:00:26,280 --> 00:00:27,500
We are comparing.

7
00:00:27,630 --> 00:00:35,520
If the value of variable of our is greater than 7 and on the last example we have two conditions.

8
00:00:35,520 --> 00:00:46,460
We are comparing If our variable Vohra is equal to 5 and variable count not equal to 1 pre-state era

9
00:00:46,460 --> 00:00:52,190
when writing IF statement because there is a need for a space almost everywhere.

10
00:00:52,340 --> 00:00:59,290
So be careful to not omit based next two brackets and around two operand.

11
00:00:59,440 --> 00:01:04,980
I believe that those slides are good as an introduction for a mathematical comparison.

12
00:01:05,170 --> 00:01:11,630
But let's write some script to see it in practice because only writing scripts makes you an expert.

13
00:01:13,500 --> 00:01:19,560
I will create Scribd riginal do multiplication of two numbers inserted as arguments.

14
00:01:20,040 --> 00:01:21,080
Let's name it.

15
00:01:21,420 --> 00:01:27,790
Multiply two numbers not as H.

16
00:01:34,140 --> 00:01:38,780
On the first line as you go shopping Big Bash

17
00:01:41,700 --> 00:01:42,940
now I sign for it.

18
00:01:42,960 --> 00:01:45,910
I will and two variables first.

19
00:01:48,120 --> 00:01:50,930
And second two variables second.

20
00:01:51,270 --> 00:01:59,370
Second equals do not assign to multiplication can be done using that.

21
00:01:59,660 --> 00:02:10,880
So that result equals first Asterix second and now we can print the result using eco common

22
00:02:13,770 --> 00:02:15,570
equal sign.

23
00:02:15,680 --> 00:02:24,740
First step is dollar signs second equals sign.

24
00:02:24,770 --> 00:02:25,940
Result.

25
00:02:26,360 --> 00:02:33,410
Don't forget on basic rule when we are setting variable we don't use dollar sign in front of them.

26
00:02:33,620 --> 00:02:42,560
But when we want to work with the value of that variable we need to prepare and dollar sign.

27
00:02:42,710 --> 00:02:44,120
Now we can save the file

28
00:02:46,930 --> 00:02:48,860
ground execute permission

29
00:02:51,960 --> 00:03:04,330
and around descript and then we can specify some arguments to and fro for example great result is done.

30
00:03:04,620 --> 00:03:10,380
But what happens if we provide only one argument we see some strange output.

31
00:03:10,450 --> 00:03:20,350
Also if you provide more arguments scrip operate only with first two and skidoos it can be confused.

32
00:03:20,540 --> 00:03:24,840
So what to do social is to have logic in our script.

33
00:03:25,100 --> 00:03:30,020
Doudeville exit script when arguments count is different from two.

34
00:03:30,200 --> 00:03:31,450
Does it make sense.

35
00:03:31,570 --> 00:03:32,240
That's right.

36
00:03:40,570 --> 00:03:46,980
Firstly I will write some command so we know exactly what we are going to do.

37
00:03:49,000 --> 00:03:53,800
Exit the script.

38
00:03:54,050 --> 00:04:02,320
There is more or less done exactly two arguments

39
00:04:05,670 --> 00:04:06,690
on the new line.

40
00:04:06,690 --> 00:04:07,790
Right.

41
00:04:08,010 --> 00:04:15,940
If and break it we know that arguments count can be printed using dollar sign hash.

42
00:04:15,960 --> 00:04:26,400
So not assign a hash not equal to or we can negate this if so instead of not equal right equal and right.

43
00:04:26,490 --> 00:04:29,100
Exclamation mark at the beginning.

44
00:04:33,710 --> 00:04:37,520
Also don't forget spaces in that condition.

45
00:04:37,790 --> 00:04:47,080
So if that condition is true what we want to do we can bring some in from my seat as to arguments needed

46
00:04:49,520 --> 00:04:50,810
around a script

47
00:04:53,380 --> 00:04:57,120
with two arguments.

48
00:04:57,950 --> 00:04:59,570
But death is not all.

49
00:04:59,570 --> 00:05:07,280
If we close here if stateman that command would be still executed and a result result variable would

50
00:05:07,280 --> 00:05:08,690
be printed.

51
00:05:08,690 --> 00:05:10,840
We need to exit scribbly here.

52
00:05:10,970 --> 00:05:16,830
So type exit 2 1 and closed the if statement using f i

53
00:05:23,830 --> 00:05:32,690
now we can save the script and see how it looks like when they're running with three months.

54
00:05:33,850 --> 00:05:42,340
We got a message saying around two arguments are great the same is when we use only one argument for

55
00:05:42,660 --> 00:05:43,280
women's.

56
00:05:43,330 --> 00:05:51,900
It is working perfectly but would happen if one argument is some string bought instead of number we

57
00:05:51,910 --> 00:05:53,600
see stretched out.

58
00:05:54,520 --> 00:05:59,890
But we can get rid of it using exit status to make some change in the script

59
00:06:03,220 --> 00:06:11,080
we can display exit status of all that common exit status of previous command can be displayed using

60
00:06:11,080 --> 00:06:12,190
dollar sign.

61
00:06:12,190 --> 00:06:13,400
Question mark.

62
00:06:13,690 --> 00:06:18,910
So just write equal exit so that those

63
00:06:21,490 --> 00:06:26,780
from all command are assigned.

64
00:06:26,780 --> 00:06:27,750
Question mark

65
00:06:32,130 --> 00:06:40,650
now when we ran the script with string as argument we see that exit status is on when we put only two

66
00:06:40,650 --> 00:06:44,690
numbers as arguments and the status is zero.

67
00:06:44,790 --> 00:06:50,790
We can use this knowledge and the right another condition which will ensure that result is printed if

68
00:06:50,850 --> 00:06:54,220
only two numbers are provided to come on.

69
00:06:54,380 --> 00:07:06,520
That means that we will print this out only if exit status equals zero.

70
00:07:06,530 --> 00:07:12,530
So after that line put another statement

71
00:07:16,050 --> 00:07:27,400
if bracket exits that those dollar sign CAUCHON are not equal to zero.

72
00:07:27,960 --> 00:07:36,430
Then we'll print some message equal.

73
00:07:36,720 --> 00:07:38,220
You need to fold

74
00:07:42,840 --> 00:07:50,150
to integer once ran the script again.

75
00:07:52,420 --> 00:07:57,390
And of course we need to exit here.

76
00:07:57,500 --> 00:08:01,370
I can for example choose at those two

77
00:08:06,070 --> 00:08:08,200
after housekeeper.

78
00:08:08,790 --> 00:08:11,240
I have a printing of resolved

79
00:08:17,890 --> 00:08:29,140
so I will just delete the previously decline and pull back the echo line with the result and close the

80
00:08:29,140 --> 00:08:30,490
if statement using.

81
00:08:30,670 --> 00:08:30,970
I

82
00:08:33,780 --> 00:08:34,770
now save the script

83
00:08:38,250 --> 00:08:41,120
and we can write with two arguments.

84
00:08:41,130 --> 00:08:45,160
It works perfectly when we use think in arguments.

85
00:08:45,480 --> 00:08:46,150
Yeah great.

86
00:08:46,170 --> 00:08:49,040
We have message you need to put two integer.

87
00:08:49,120 --> 00:08:56,730
I want that when we see what is exist at those we see number two

88
00:09:00,890 --> 00:09:13,830
when we use Swee arguments the exist that those is one great and of course the script is working perfectly

89
00:09:14,730 --> 00:09:19,380
to multiply five earfuls then this is the most important thing.
