Now that our program is completed, let's go and bring some change to this.
Because right now, as you see, it is kind of messy, not really messy.
It is good, but it's better to change it to functions.
Okay.
As you see here at this part, this block of code is going to change the Mac address okay.
And this block of code is going to get the argument okay.
So let's go and create two functions.
One of them is for getting the argument from terminal.
The next one is for changing the Mac address.
So whenever we need it in other programming in other program files.
So we it is better to access them from here or we just can use the function.
Okay.
So here I'm going to create a new function.
Name it change Mac okay.
So as you know it is asking for interface and new Mac.
Okay.
Now let's have this part into the Function.
I'm going to add this.
Use control X and then hit a tab here and then paste it right in here okay.
Okay.
Now we have it and it is complete this part okay.
And here let's call it here it is change okay.
Change Mac.
And here we are going to give that which is interface.
And new Mac address which is new Mac address okay.
So right now we call it and I'm sure there is no problem.
So also this part or this block of code is getting the argument okay.
So for that again I'm going to come here and create another function.
And I'm going to name it get arguments.
Okay.
And I think it is not asking for anything for from for input.
Because all I knew thing is commands here so it doesn't need anything.
Okay so let's control x.
That and paste it here.
Let's hit tab here.
Okay.
Now it is good.
That is still here.
We have the argument and option.
That is not here.
Okay.
While we are using it right here it is not able to access it because it's inside this function.
Okay.
So here I'm going to remove this.
And instead of this I'm going to return return this part.
And here I can use it.
Okay.
Very easy.
Now instead of giving interface and new Mac I am going to just use that.
Like here.
Right here is going to be options.
And what was the next one.
It was argument.
Arguments.
And it is equal to get argument.
Okay.
And it is not asking for anything as in.
So.
Okay.
And here now instead of using interface and new Mac address, that is something we don't need because
here now we can use options dot interface and options dot new Mac.
Okay.
So this is how we could change this in a better way.
Okay.
Now I think it is completed.
Let's save it and go to change this.
So now you know that the Mac address is 99.
Let's clear the terminal and let's use this to change it back to five five.
Okay.
Let's.
Use ifconfig.
Now you see it is five five with no changes with no problem.
Okay.
So now I think the program is looking good.
It is better and almost complete.
Thanks for watching and I will see you in the next lecture.