Okay, now the program is almost completed.
Okay.
We have gone up to here and let me see the terminal here.
You see, while we are executing our program, first it is showing us the result for ifconfig and then
it is printing me the current Mac address.
So it is not what we want okay.
So let's go.
What is the c.
What is the the next step.
It is checking if mac in ifconfig is what the user requested or not.
Okay I will do that in the next lecture.
But here I am going to handle this okay.
As you see this, all are is responsible for getting the current Mac address.
So I'm going to move this into a new function okay I'm going to cut this.
And let's create a new function here.
Let's say get current Mac address.
And you know that it is asking or for interface getting the interface.
So let's.
Hit tab here.
and here.
One thing that we don't need to use is options.
And options here is out of this function, as it's almost in the other area, and we are not able to
access it from here.
So I need to remove that option from here.
There we go and print if config result I don't need to print the result for if config and then.
The thing I need here into the if statement.
As you see here, we are printing this Mac address search result.
It is better to return this okay.
While we we use something in function it is better to return.
Okay.
So now it is returning the Mac address search result and later we can get it here.
And then we will be able to use it okay.
So good.
Now let's come right here I'm going to use that here okay.
It is.
Just get the current Mac address.
Okay.
So let's use that get current Mac address.
Here I am going to give the interface okay options dot interface.
Okay.
So now we have it I am going to store this into a variable.
Let's name this variable.
Current Mac okay.
Now that we have this current Mac here I am going to print the current Mac address.
So here what it is trying to change to get the current Mac address.
So if it is able to get it we will be able to print it here.
If it is not able to get the current Mac address.
So it will print this one, but not Mac address.
So here I am going to print
um current.
Mac address is equal to concatenate this with current Mac.
Okay, maybe this current Mac is not a string.
So if it is not a string, you need to change it to str, which is string.
Okay.
Now I'm going to save this and let's go back here.
Right now I'm trying to change this for eth0 or access it for eth0 and trying to change it.
You see it is giving me the current Mac address is equal to something like this.
And what if I try to access it for low.
And you see that could not read the Mac address and current Mac current Mac is equal to Nat.
So perfect.
Now we are able to have a better look of the error message.
Instead of having a lot of thing.
Here we have only two messages.
Current Mac address is equal to current Mac address, and the current Mac address is equal to none.
Okay.
So perfect.
Let's go and see how we can do the next part which is which is to check if Mac in if config is what
the user requested.
So let's go and see that.