What is exist that those exit status is a numerical value which can tell us if previously called script
or previously executed command was successful or not.
We can get this value by printing value of dollar sign and question mark disvalue is being called Egli
status if his status equals zero.
It means that previously quoted command or script was successful if the status is some non-zero value.
It means that previously is a coded script or a function or command was finished.
Or did it means that something finished on it.
It basically means that something went wrong.
That there is missing argument in the script that some file which should exist doesn't exist and so
on.
Important is to know that when we are creating script we can exit it using exit command.
That means that descript will be exited immediately and other alliance of those won't be processed by
specifying Exit 0 or Exit 1 or some other non-zero number.
We said the exit status but enough talking.
Let's write some script to see it in practice.
We can check exit status is also here in termino.
But first to make sure that our show is abash by typing ecord a lot assign 0.
I can see that my show is back.
I can easily change it to for example Desch by typing that.
Because this is located in bin and bin is included in my pop.
Now I can switch to for example s h which is by looking using ls command.
Only the link to dash.
I can switch back to bed now and can use Wopat been beshe or only in my case.
So now let's write some commands and see data exit statuses right.
Echo Hello body.
And now to display the Is that right.
The Larson questionmark
you see that exit status is zero.
That means that the command was successful.
We can also try to do some variable assignment using what will that equals five multiply by 5 and we
see that exit status is zero.
Again let's make some error in our command.
Right.
Let the Vohra equals five a string.
It is not possible to do multiplication with stink by typing Ecko dollar sign.
Question mark.
We see that as his status is one that means that something was wrong with that.
C'mon.
Maybe you think that working here in terminal is useless when we cannot type more comments on more lines
because command on the line is executed immediately.
But it's not true.
We can write more commands here.
I will show you how in our previous example we let I woke up and semicolon which means that I can write
another command and both commands will be executed.
So lots of printing of the result ecord called dollar sign.
Vohra great.
Have you noticed that when we displaying existences we've got only numbers.
Let's make it more readable.
So when we in future will ask for existing tools we will get exit's that those equals some number Varietes
that was exposed dollar sign question mark semi-colon equal status equals dollar sign status.
Now we see that previous command was successful.
So I will again put them on with led operation
and I can see that as that status is one great.
Now let's.
Finally some script let's clear the screen and create a file called X-1 don't ask age.
Start with.
Been beshe
next grade variable var and assigned to either value 1.
We can then increment it using God command and then we can display the value after incrementation eco
water Dorsai in water.
Now I will keep a block of commenced fi's
and save descript
after changing permission.
I can get
great.
It is working.
I can check for that tools and it's zero scribbles executed successfully.
Now that's actually descript using Gaumont exit.
I will type exit one after second book of my code
Solas around it.
I see that only do Eco commands are printed and Eco's that those is
one great.
I can now type exit before second echo command.
And Viele exiting with stutterers for example 5 when we add on it we can only see one output.
Great exit status is five.
You should only use exit stuff to see in a range from 0 to 200 55.
If you exit divid for example 256
exists that also will be in the the ID 0 for 257 will be at the start of the RAM and so on
save the script and the Damita to seed
and exit status is zero.
As I said in our example I used exit command just to show you how it is working.
In the real world you would use them if for example some condition were true.
And we will definitely show this in and under the lecturer's.