1
00:00:01,030 --> 00:00:08,860
What is exist that those exit status is a numerical value which can tell us if previously called script

2
00:00:09,190 --> 00:00:13,970
or previously executed command was successful or not.

3
00:00:14,320 --> 00:00:21,370
We can get this value by printing value of dollar sign and question mark disvalue is being called Egli

4
00:00:21,380 --> 00:00:25,340
status if his status equals zero.

5
00:00:25,390 --> 00:00:33,560
It means that previously quoted command or script was successful if the status is some non-zero value.

6
00:00:33,850 --> 00:00:40,010
It means that previously is a coded script or a function or command was finished.

7
00:00:40,560 --> 00:00:44,630
Or did it means that something finished on it.

8
00:00:44,680 --> 00:00:47,130
It basically means that something went wrong.

9
00:00:47,410 --> 00:00:52,270
That there is missing argument in the script that some file which should exist doesn't exist and so

10
00:00:52,270 --> 00:00:53,080
on.

11
00:00:53,350 --> 00:00:59,950
Important is to know that when we are creating script we can exit it using exit command.

12
00:00:59,950 --> 00:01:07,660
That means that descript will be exited immediately and other alliance of those won't be processed by

13
00:01:07,660 --> 00:01:13,030
specifying Exit 0 or Exit 1 or some other non-zero number.

14
00:01:13,060 --> 00:01:16,960
We said the exit status but enough talking.

15
00:01:17,060 --> 00:01:19,820
Let's write some script to see it in practice.

16
00:01:22,230 --> 00:01:25,590
We can check exit status is also here in termino.

17
00:01:25,860 --> 00:01:33,410
But first to make sure that our show is abash by typing ecord a lot assign 0.

18
00:01:33,780 --> 00:01:36,260
I can see that my show is back.

19
00:01:37,080 --> 00:01:41,680
I can easily change it to for example Desch by typing that.

20
00:01:42,090 --> 00:01:52,170
Because this is located in bin and bin is included in my pop.

21
00:01:52,390 --> 00:02:00,370
Now I can switch to for example s h which is by looking using ls command.

22
00:02:05,100 --> 00:02:08,550
Only the link to dash.

23
00:02:09,100 --> 00:02:23,170
I can switch back to bed now and can use Wopat been beshe or only in my case.

24
00:02:23,300 --> 00:02:27,960
So now let's write some commands and see data exit statuses right.

25
00:02:28,010 --> 00:02:33,180
Echo Hello body.

26
00:02:33,300 --> 00:02:35,920
And now to display the Is that right.

27
00:02:36,800 --> 00:02:38,250
The Larson questionmark

28
00:02:41,280 --> 00:02:43,080
you see that exit status is zero.

29
00:02:43,080 --> 00:02:45,360
That means that the command was successful.

30
00:02:45,360 --> 00:02:54,120
We can also try to do some variable assignment using what will that equals five multiply by 5 and we

31
00:02:54,120 --> 00:02:56,070
see that exit status is zero.

32
00:02:56,070 --> 00:03:00,020
Again let's make some error in our command.

33
00:03:00,150 --> 00:03:00,490
Right.

34
00:03:00,480 --> 00:03:04,230
Let the Vohra equals five a string.

35
00:03:04,860 --> 00:03:09,500
It is not possible to do multiplication with stink by typing Ecko dollar sign.

36
00:03:09,590 --> 00:03:10,400
Question mark.

37
00:03:10,410 --> 00:03:14,940
We see that as his status is one that means that something was wrong with that.

38
00:03:14,960 --> 00:03:15,870
C'mon.

39
00:03:16,890 --> 00:03:22,950
Maybe you think that working here in terminal is useless when we cannot type more comments on more lines

40
00:03:23,160 --> 00:03:27,140
because command on the line is executed immediately.

41
00:03:27,480 --> 00:03:28,680
But it's not true.

42
00:03:28,680 --> 00:03:30,960
We can write more commands here.

43
00:03:30,990 --> 00:03:38,340
I will show you how in our previous example we let I woke up and semicolon which means that I can write

44
00:03:38,430 --> 00:03:41,810
another command and both commands will be executed.

45
00:03:42,030 --> 00:03:46,830
So lots of printing of the result ecord called dollar sign.

46
00:03:46,850 --> 00:03:49,540
Vohra great.

47
00:03:49,920 --> 00:03:54,940
Have you noticed that when we displaying existences we've got only numbers.

48
00:03:55,050 --> 00:03:56,370
Let's make it more readable.

49
00:03:56,370 --> 00:04:04,990
So when we in future will ask for existing tools we will get exit's that those equals some number Varietes

50
00:04:05,010 --> 00:04:15,650
that was exposed dollar sign question mark semi-colon equal status equals dollar sign status.

51
00:04:15,660 --> 00:04:18,900
Now we see that previous command was successful.

52
00:04:18,990 --> 00:04:21,880
So I will again put them on with led operation

53
00:04:25,380 --> 00:04:30,450
and I can see that as that status is one great.

54
00:04:30,510 --> 00:04:31,500
Now let's.

55
00:04:31,620 --> 00:04:43,670
Finally some script let's clear the screen and create a file called X-1 don't ask age.

56
00:04:43,940 --> 00:04:45,370
Start with.

57
00:04:46,320 --> 00:04:47,030
Been beshe

58
00:04:49,920 --> 00:04:55,400
next grade variable var and assigned to either value 1.

59
00:04:55,470 --> 00:05:04,550
We can then increment it using God command and then we can display the value after incrementation eco

60
00:05:08,150 --> 00:05:13,980
water Dorsai in water.

61
00:05:14,410 --> 00:05:16,930
Now I will keep a block of commenced fi's

62
00:05:24,620 --> 00:05:25,670
and save descript

63
00:05:30,330 --> 00:05:32,030
after changing permission.

64
00:05:36,200 --> 00:05:36,860
I can get

65
00:05:41,230 --> 00:05:41,930
great.

66
00:05:41,940 --> 00:05:42,980
It is working.

67
00:05:43,230 --> 00:05:50,420
I can check for that tools and it's zero scribbles executed successfully.

68
00:05:52,110 --> 00:05:58,440
Now that's actually descript using Gaumont exit.

69
00:05:59,000 --> 00:06:03,840
I will type exit one after second book of my code

70
00:06:15,580 --> 00:06:17,260
Solas around it.

71
00:06:18,220 --> 00:06:23,130
I see that only do Eco commands are printed and Eco's that those is

72
00:06:25,930 --> 00:06:29,670
one great.

73
00:06:29,940 --> 00:06:33,930
I can now type exit before second echo command.

74
00:06:44,190 --> 00:06:53,810
And Viele exiting with stutterers for example 5 when we add on it we can only see one output.

75
00:06:53,990 --> 00:07:00,490
Great exit status is five.

76
00:07:00,610 --> 00:07:05,700
You should only use exit stuff to see in a range from 0 to 200 55.

77
00:07:05,920 --> 00:07:08,920
If you exit divid for example 256

78
00:07:11,630 --> 00:07:18,370
exists that also will be in the the ID 0 for 257 will be at the start of the RAM and so on

79
00:07:21,080 --> 00:07:24,080
save the script and the Damita to seed

80
00:07:29,270 --> 00:07:32,450
and exit status is zero.

81
00:07:32,490 --> 00:07:39,700
As I said in our example I used exit command just to show you how it is working.

82
00:07:40,060 --> 00:07:44,980
In the real world you would use them if for example some condition were true.

83
00:07:45,280 --> 00:07:48,380
And we will definitely show this in and under the lecturer's.
