WEBVTT

00:01.320 --> 00:07.160
Now that our program is completed, let's go and bring some change to this.

00:07.160 --> 00:11.200
Because right now, as you see, it is kind of messy, not really messy.

00:11.240 --> 00:14.920
It is good, but it's better to change it to functions.

00:14.960 --> 00:15.560
Okay.

00:15.600 --> 00:22.560
As you see here at this part, this block of code is going to change the Mac address okay.

00:22.600 --> 00:27.880
And this block of code is going to get the argument okay.

00:27.920 --> 00:30.200
So let's go and create two functions.

00:30.200 --> 00:33.240
One of them is for getting the argument from terminal.

00:33.240 --> 00:36.760
The next one is for changing the Mac address.

00:36.760 --> 00:40.560
So whenever we need it in other programming in other program files.

00:40.560 --> 00:47.160
So we it is better to access them from here or we just can use the function.

00:47.200 --> 00:48.080
Okay.

00:48.120 --> 00:51.760
So here I'm going to create a new function.

00:51.760 --> 00:55.880
Name it change Mac okay.

00:55.920 --> 01:03.800
So as you know it is asking for interface and new Mac.

01:06.000 --> 01:06.440
Okay.

01:07.000 --> 01:12.380
Now let's have this part into the Function.

01:12.420 --> 01:14.020
I'm going to add this.

01:14.020 --> 01:20.620
Use control X and then hit a tab here and then paste it right in here okay.

01:23.660 --> 01:24.020
Okay.

01:24.540 --> 01:28.980
Now we have it and it is complete this part okay.

01:28.980 --> 01:36.540
And here let's call it here it is change okay.

01:36.580 --> 01:37.420
Change Mac.

01:38.980 --> 01:44.020
And here we are going to give that which is interface.

01:46.220 --> 01:50.420
And new Mac address which is new Mac address okay.

01:50.820 --> 01:54.620
So right now we call it and I'm sure there is no problem.

01:55.020 --> 02:02.060
So also this part or this block of code is getting the argument okay.

02:02.100 --> 02:06.140
So for that again I'm going to come here and create another function.

02:06.140 --> 02:09.780
And I'm going to name it get arguments.

02:13.100 --> 02:13.540
Okay.

02:14.900 --> 02:20.380
And I think it is not asking for anything for from for input.

02:20.380 --> 02:25.880
Because all I knew thing is commands here so it doesn't need anything.

02:26.040 --> 02:28.120
Okay so let's control x.

02:28.160 --> 02:30.520
That and paste it here.

02:33.480 --> 02:34.800
Let's hit tab here.

02:35.520 --> 02:35.880
Okay.

02:36.440 --> 02:37.800
Now it is good.

02:38.680 --> 02:40.800
That is still here.

02:41.240 --> 02:43.320
We have the argument and option.

02:43.840 --> 02:46.200
That is not here.

02:46.240 --> 02:46.920
Okay.

02:46.960 --> 02:54.040
While we are using it right here it is not able to access it because it's inside this function.

02:54.080 --> 02:55.000
Okay.

02:55.000 --> 02:57.920
So here I'm going to remove this.

02:58.800 --> 03:03.320
And instead of this I'm going to return return this part.

03:03.360 --> 03:05.560
And here I can use it.

03:05.600 --> 03:06.240
Okay.

03:06.280 --> 03:08.440
Very easy.

03:08.480 --> 03:14.360
Now instead of giving interface and new Mac I am going to just use that.

03:14.360 --> 03:15.280
Like here.

03:15.280 --> 03:17.520
Right here is going to be options.

03:18.120 --> 03:20.280
And what was the next one.

03:20.360 --> 03:21.600
It was argument.

03:24.640 --> 03:25.520
Arguments.

03:26.520 --> 03:30.360
And it is equal to get argument.

03:30.400 --> 03:30.920
Okay.

03:30.960 --> 03:33.820
And it is not asking for anything as in.

03:34.460 --> 03:35.060
So.

03:35.100 --> 03:35.500
Okay.

03:36.220 --> 03:44.460
And here now instead of using interface and new Mac address, that is something we don't need because

03:44.460 --> 03:54.940
here now we can use options dot interface and options dot new Mac.

03:55.420 --> 03:55.820
Okay.

03:56.660 --> 04:02.700
So this is how we could change this in a better way.

04:02.740 --> 04:03.260
Okay.

04:03.300 --> 04:05.260
Now I think it is completed.

04:05.500 --> 04:09.660
Let's save it and go to change this.

04:10.780 --> 04:13.380
So now you know that the Mac address is 99.

04:13.540 --> 04:22.820
Let's clear the terminal and let's use this to change it back to five five.

04:22.860 --> 04:23.260
Okay.

04:23.780 --> 04:24.180
Let's.

04:26.700 --> 04:27.500
Use ifconfig.

04:27.540 --> 04:33.700
Now you see it is five five with no changes with no problem.

04:33.740 --> 04:34.140
Okay.

04:34.460 --> 04:38.300
So now I think the program is looking good.

04:39.460 --> 04:42.700
It is better and almost complete.

04:42.940 --> 04:45.220
Thanks for watching and I will see you in the next lecture.
