WEBVTT

00:01.400 --> 00:02.390
Hello, my name is Stephanie.

00:02.390 --> 00:04.690
Welcome to another lecture of our course.

00:04.730 --> 00:10.670
In this section we are going to look at the some of the magic that occurs on the command line when we

00:10.670 --> 00:12.710
press the enter key.

00:13.220 --> 00:19.400
While we will examine several interesting and complex features of the shell, we will do it with just

00:19.400 --> 00:26.660
a one new command which is echo to display lay line of the text.

00:26.660 --> 00:28.130
So let's get started.

00:41.370 --> 00:48.840
Each time we type a command and press, the Enter Key Bash performs several substitutions upon the text

00:48.840 --> 00:51.520
before it carries out our command.

00:51.540 --> 00:57.810
So we have seen a couple of cases of how a simple character sequence, for example, these asterisks

00:57.810 --> 00:59.890
can have a lot of meaning on the shell.

00:59.910 --> 01:04.920
So the process that makes this happen is called the expansion.

01:04.920 --> 01:06.620
Actually, let me mention it here.

01:06.630 --> 01:09.630
So expansion.

01:14.280 --> 01:15.180
Expansion.

01:15.180 --> 01:23.430
So with expansion, we enter something and it is expanded into something else before the shell acts

01:23.430 --> 01:23.940
upon.

01:23.940 --> 01:31.290
So to demonstrate that what we mean by this, let's look at the echo command here.

01:31.710 --> 01:32.280
So here.

01:32.280 --> 01:33.930
So let's look at the echo command.

01:33.930 --> 01:40.500
So echo echo here is a shell builtin that performs a very simple task.

01:40.530 --> 01:44.850
It prints its text arguments on a standard output.

01:44.850 --> 01:46.140
So if you write it like that.

01:46.140 --> 01:51.840
So echo, this is a Oxley lecture.

01:52.350 --> 01:56.280
And here, as you can see here, we write it it this is Oxley lecture.

01:56.280 --> 01:58.350
So that's pretty straightforward, right?

01:58.350 --> 02:03.000
So any argument passed to Echo gets displayed.

02:03.000 --> 02:04.680
So let's try another example here.

02:04.680 --> 02:08.790
So clear echo this here asterisk.

02:08.790 --> 02:11.400
And as you can see, we've created this.

02:11.400 --> 02:12.270
So.

02:13.620 --> 02:14.520
For example.

02:14.520 --> 02:15.180
Eko.

02:16.050 --> 02:16.920
Eko.

02:18.390 --> 02:19.700
Eko, LZ.

02:21.990 --> 02:22.950
LZ.

02:23.220 --> 02:24.990
And here we can also write it like that.

02:24.990 --> 02:29.370
And as you can see here, each argument we write in Echo, we are just seeing it.

02:29.370 --> 02:30.090
So.

02:31.720 --> 02:32.560
Here.

02:34.010 --> 02:38.070
Let's write the term expansion and learn more about it.

02:38.090 --> 02:44.960
So the mechanism by which wild cards work is called the Pathname expansion.

02:45.290 --> 02:51.020
If we try some of the techniques that we employed in earlier lectures, we will see that they are really

02:51.020 --> 02:51.530
expansions.

02:51.540 --> 03:01.400
So given a home directory that looks like, for example, LZ and oops, actual CD here and here echo

03:01.700 --> 03:02.020
here.

03:02.030 --> 03:06.560
And as you can see here, we've created our like LZ here so clear.

03:06.560 --> 03:10.100
And let's echo D here and here.

03:10.100 --> 03:12.620
As you can see here, we started the arguments.

03:13.970 --> 03:14.630
So.

03:16.000 --> 03:17.530
We can also do it like that.

03:17.710 --> 03:22.210
For example, Echo is here, and as you can see here, we will print that.

03:22.990 --> 03:28.240
Uh, templates or documents that ends with s character.

03:28.240 --> 03:29.350
We can also do it like that.

03:29.740 --> 03:36.160
Echo two here, braces like that and upper, upper and here like that.

03:36.160 --> 03:42.010
And after the asterisk here and as you can see here, we printed all of that, that starts with the

03:42.010 --> 03:43.930
uppercase character.

03:45.430 --> 03:48.610
And we can also do it like that, for example, Echo.

03:49.450 --> 03:56.680
That's actually that's pretty complex and straightforward comments with with which you will learn all

03:56.680 --> 03:59.650
of the echo commands in this course.

03:59.650 --> 04:07.090
So Echo, for example, user asterisk, wildcard operator, some called asterisk, some called wildcard

04:07.120 --> 04:08.620
here share.

04:08.620 --> 04:12.040
And as you can see here, we printed our user local share.

04:12.310 --> 04:16.930
So that is called the Pathname expansion of a hidden files.

04:16.930 --> 04:21.610
So as we know, files that begin with a period, characters are hidden.

04:21.610 --> 04:30.190
So a pathname expansion also respects this behavior and expansion such as this here echo this asterisk.

04:30.220 --> 04:33.700
This will not reveal hidden files.

04:33.700 --> 04:38.380
So it might appear at first glance that we could include hidden files in an expansion, for example,

04:38.380 --> 04:44.830
like this that starts with this, uh, by starting a pattern with a leading period like this.

04:44.830 --> 04:47.960
And as you can see here, we got it.

04:47.960 --> 04:49.100
But it almost works.

04:49.100 --> 04:56.060
However, if we examine the results closely, we will see that the names from that starts with dot and

04:56.060 --> 04:56.600
double.

04:56.600 --> 05:05.300
That here will also appear in the results because these names refer to the current working directory

05:05.300 --> 05:06.710
and its parent directory.

05:06.740 --> 05:11.150
Using this pattern will include will likely produce an incorrect result.

05:11.150 --> 05:14.410
So we can see this if we try this command here.

05:14.420 --> 05:15.230
Clear.

05:15.350 --> 05:16.190
Oops, clear.

05:16.190 --> 05:21.650
And here we will list the and wildcard operator.

05:21.650 --> 05:26.300
After that we will use pipes and less here.

05:26.300 --> 05:30.800
And as you can see here, we got this our desired results here.

05:30.800 --> 05:32.600
So actually, let's end this.

05:34.040 --> 05:34.370
Oops.

05:37.710 --> 05:38.490
Here.

05:41.610 --> 05:43.720
Oh, can we change this color?

05:43.740 --> 05:47.730
I didn't realize that we can change the color of this.

05:50.240 --> 05:51.020
Here.

05:52.750 --> 05:53.200
Yeah.

05:53.200 --> 05:53.920
Let's.

05:54.840 --> 05:55.250
Quit.

05:55.440 --> 05:57.020
So whatever here.

05:57.030 --> 06:02.190
Now we're going to use this echo and echo dot.

06:02.950 --> 06:04.120
Braces.

06:06.150 --> 06:07.470
And here asterisk.

06:07.500 --> 06:10.890
And as you can see here, the event not found.

06:10.920 --> 06:12.530
We got an error here.

06:12.540 --> 06:17.340
So this pattern here, echo and as you can see here, this.

06:18.680 --> 06:27.920
So this pattern expands into every file name that begins with only one, followed by another characters.

06:27.920 --> 06:30.800
So this will work correctly with most hidden files.

06:30.800 --> 06:36.710
So it will it will not include file names with multiple leading periods and the LS command.

06:36.710 --> 06:40.550
With this a option uppercase.

06:40.550 --> 06:45.320
A option will print this to print that.

06:46.680 --> 06:47.310
Uh, so.

06:48.940 --> 06:49.880
And we will.

06:49.900 --> 06:54.460
And as you can see, we got an correct listing of a hidden files.

06:54.460 --> 06:56.110
So I'm waiting you in next lecture.
