Open our script files and of age
it would be good to know if user has entered some location.
So for that case we can create variable which will as if location was set or not.
So set into variable and let's name it lockset value valuable.
And before starting.
While loop set that variable value 0
and we can also write the command.
What it means.
So 0 represents that location is not set.
And number one
will in that case mean that location was set by an.
So that means if user specified some location and value of variable lockset would be on the device it
will be still zero
in the same way we can create variable starts and these mean if user vaunts from script some statistics
this variable will have to come and revise it if you will have value 0.
We can also write some comment here.
So one means do not display statistics
and one means this by statistics
but why we need that variables in a case of location.
We need to know that information because of a news or don't use location parameter don't specify a location.
We should use his or her current directory.
So after dumb keyboard of a WHILE loop right if statement.
So if a value of variable lockset
is not equal to one
then we can set into variable location output of B W D command.
And for that we will use command substitution.
So if user didn't specify a location we are using current directory.
And after this if statement we can print using eco commom value of variable location
now save the file and we can run the script so we don't parameter it.
My current directory.
OK this is working.
But what if I specify another location.
For example EDC
So using our parameter I specify new directory.
And it prints the location is it is the same it is for bin directory.
This is working.
Now I tried the right tools barometer location
and it is working in the same way.
Great.
And if I use some not existing permit that I will get printed usage message grade.