So let's start building our final script grade file called files that age
on different lines starting with champagne.
And on the next line write description what we are going to build that we are building script files
as age which can takes barometers dish out followed by location or parameter location followed by location
then barometer E followed by extension or parameter extension followed by extension then it can express
Meteora age or barometer help.
Now we need to know what parameters are selected by user.
So we will read arguments.
So right while number of arguments is greater than zero.
So for that condition we will perform something between keyboards do and an.
Now we need to ask what is the first argument
and if the first argument is Desch how or does the education
we will assign into variable location
value of second argument.
Why.
Because we are expecting a location of value right after the parameter or a parameter location.
We can ensure that value of variable location is really a directory using this thing operand.
The
and if location is not a directory we can put an end to user information how to use our script
so override each Richie's function will create lately.
Now if location is a directory we can throw away two arguments one for barometer and one for location
value.
So now if the first argument is to eat or a dish dish extension
we will assign it to variable x the value of second argument.
Second argument is represented as dollar sign too.
And then you can just throw away first two arguments.
This is the same as we did for obligacion.
If the first argument is that s or a dash dash starts before now
just for that argument because we will come back to this section later.
And if it is the first argument Desch age or does it help
the fro of a moment and also you can display some usage information.
So we are calling function usage
and now if the first argument has some different value with that friend to users information how to
use our script.
So again calling the function usage
now we can close K-State and then and we can right now the usage function because it is not defined
it.
So before the actual calling of that function we are creating a function usage
and in that function we can print using equal command
use each
dollar sign zero which represents scathed name.
And then we can just copy the description from our own and after pasting this
we can also put into some examples it will be good for them to see how the script can be used in some
examples.
So now on a new line we can write to using eco command for example examples and then we need to specify
some examples.
So on another line again Rideman eco commom and right have to assign zero which represents our script
name.
And you can use for example our barometer for location and also you can specify Paromita the parameter
s and on.
Another example we can for example specify the parameter and parameter starts and that's all.
And exit this function with X is that those 1.
Now we have basic structure of our script so we can say it is a good permissions.
And for now that I do run into but I meet are out and do some allocation
it doesn't print anything which is good as no error is printed.
Same with parameter as.
And then we can ask for help
and it is working.
We see usage message.
Good.
Now we can check if you get error message 4 extension parameter
and no we didn't.
It worked fine for now.
So in next lecture we can add more functionality into our script.