So let's start building our ascript create file spaces not as page and started with siobhán on the first
line and then on an other line we can write comment about how to use our script so we can use barometer
or filed out
barometer Desch or dash dash fix for fixing the issues.
And we can also use barometers dash age or Dish dish help for displaying health information.
So in order to have script working we need at least 1 argument file apart or help.
So if there is no argument we can bring to user usage message and exit descript.
So if a number of arguments is equal to zero
we can print usage message to user.
So we are calling function.
Who is it
then in order to know what parameters to use that has chosen we need to loop through them.
So while a number of arguments is greater than zero we've heard from commands between two and done keyboards
and now we can check what is the first argument.
So if a woman is Desch a have all the dash dash figues
we can for now just throw away that first argument which will make second argument the first of an
IF first a woman is denge age or dash dash and
we can print usage message to user.
So we are using functionally use each for that and then we can throw a first our will and then we would
like to ask if user has specified file path.
And since this option has no Paromita are such a file we just ask for a debt in US there is a section
which contains any other not specified arguments of values.
So if the first argument is a regular file
we can assign to variable court file value of first argument
and we can throw away that argument immediately.
And if that first argument Vasa not Eric rafał then we can just put to two hours how to use our script.
And this is basic structure for reading arguments.
We can now close case section using Issaq keyword.
So now before we test that we can also write that use it function
so function use each and inside function body.
Right.
You can use it.
Don't assign 0 which represents our script name then use it in the news that can use file but also can
be use Desch or fix.
And also the user can use dash age or does dash help for help information
we can't exit with status one here.
So when the user ends here there is no possibility to continue with our script.
So we can save the script and do some quick this thing.
If our structure for reading I woman's work so well
grant executive permissions
and run our script with some file location
and I got no output which is good.
Now if I specify the f parameter I have also no output printed.
But if I change that to something not existing I got a usage message.
So great and this works perfectly parameter.
Does this help should also Brind message and it does.
I can also remove file alligation
and usage message is present also which is good.
So in next lecture we can add some more functionality to our script.