1 00:00:01,400 --> 00:00:02,390 Hello, my name is Stephanie. 2 00:00:02,390 --> 00:00:04,690 Welcome to another lecture of our course. 3 00:00:04,730 --> 00: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 4 00:00:10,670 --> 00:00:12,710 press the enter key. 5 00:00:13,220 --> 00:00:19,400 While we will examine several interesting and complex features of the shell, we will do it with just 6 00:00:19,400 --> 00:00:26,660 a one new command which is echo to display lay line of the text. 7 00:00:26,660 --> 00:00:28,130 So let's get started. 8 00:00:41,370 --> 00:00:48,840 Each time we type a command and press, the Enter Key Bash performs several substitutions upon the text 9 00:00:48,840 --> 00:00:51,520 before it carries out our command. 10 00:00:51,540 --> 00:00:57,810 So we have seen a couple of cases of how a simple character sequence, for example, these asterisks 11 00:00:57,810 --> 00:00:59,890 can have a lot of meaning on the shell. 12 00:00:59,910 --> 00:01:04,920 So the process that makes this happen is called the expansion. 13 00:01:04,920 --> 00:01:06,620 Actually, let me mention it here. 14 00:01:06,630 --> 00:01:09,630 So expansion. 15 00:01:14,280 --> 00:01:15,180 Expansion. 16 00:01:15,180 --> 00:01:23,430 So with expansion, we enter something and it is expanded into something else before the shell acts 17 00:01:23,430 --> 00:01:23,940 upon. 18 00:01:23,940 --> 00:01:31,290 So to demonstrate that what we mean by this, let's look at the echo command here. 19 00:01:31,710 --> 00:01:32,280 So here. 20 00:01:32,280 --> 00:01:33,930 So let's look at the echo command. 21 00:01:33,930 --> 00:01:40,500 So echo echo here is a shell builtin that performs a very simple task. 22 00:01:40,530 --> 00:01:44,850 It prints its text arguments on a standard output. 23 00:01:44,850 --> 00:01:46,140 So if you write it like that. 24 00:01:46,140 --> 00:01:51,840 So echo, this is a Oxley lecture. 25 00:01:52,350 --> 00:01:56,280 And here, as you can see here, we write it it this is Oxley lecture. 26 00:01:56,280 --> 00:01:58,350 So that's pretty straightforward, right? 27 00:01:58,350 --> 00:02:03,000 So any argument passed to Echo gets displayed. 28 00:02:03,000 --> 00:02:04,680 So let's try another example here. 29 00:02:04,680 --> 00:02:08,790 So clear echo this here asterisk. 30 00:02:08,790 --> 00:02:11,400 And as you can see, we've created this. 31 00:02:11,400 --> 00:02:12,270 So. 32 00:02:13,620 --> 00:02:14,520 For example. 33 00:02:14,520 --> 00:02:15,180 Eko. 34 00:02:16,050 --> 00:02:16,920 Eko. 35 00:02:18,390 --> 00:02:19,700 Eko, LZ. 36 00:02:21,990 --> 00:02:22,950 LZ. 37 00:02:23,220 --> 00:02:24,990 And here we can also write it like that. 38 00:02:24,990 --> 00:02:29,370 And as you can see here, each argument we write in Echo, we are just seeing it. 39 00:02:29,370 --> 00:02:30,090 So. 40 00:02:31,720 --> 00:02:32,560 Here. 41 00:02:34,010 --> 00:02:38,070 Let's write the term expansion and learn more about it. 42 00:02:38,090 --> 00:02:44,960 So the mechanism by which wild cards work is called the Pathname expansion. 43 00:02:45,290 --> 00:02:51,020 If we try some of the techniques that we employed in earlier lectures, we will see that they are really 44 00:02:51,020 --> 00:02:51,530 expansions. 45 00:02:51,540 --> 00:03:01,400 So given a home directory that looks like, for example, LZ and oops, actual CD here and here echo 46 00:03:01,700 --> 00:03:02,020 here. 47 00:03:02,030 --> 00:03:06,560 And as you can see here, we've created our like LZ here so clear. 48 00:03:06,560 --> 00:03:10,100 And let's echo D here and here. 49 00:03:10,100 --> 00:03:12,620 As you can see here, we started the arguments. 50 00:03:13,970 --> 00:03:14,630 So. 51 00:03:16,000 --> 00:03:17,530 We can also do it like that. 52 00:03:17,710 --> 00:03:22,210 For example, Echo is here, and as you can see here, we will print that. 53 00:03:22,990 --> 00:03:28,240 Uh, templates or documents that ends with s character. 54 00:03:28,240 --> 00:03:29,350 We can also do it like that. 55 00:03:29,740 --> 00:03:36,160 Echo two here, braces like that and upper, upper and here like that. 56 00:03:36,160 --> 00:03:42,010 And after the asterisk here and as you can see here, we printed all of that, that starts with the 57 00:03:42,010 --> 00:03:43,930 uppercase character. 58 00:03:45,430 --> 00:03:48,610 And we can also do it like that, for example, Echo. 59 00:03:49,450 --> 00:03:56,680 That's actually that's pretty complex and straightforward comments with with which you will learn all 60 00:03:56,680 --> 00:03:59,650 of the echo commands in this course. 61 00:03:59,650 --> 00:04:07,090 So Echo, for example, user asterisk, wildcard operator, some called asterisk, some called wildcard 62 00:04:07,120 --> 00:04:08,620 here share. 63 00:04:08,620 --> 00:04:12,040 And as you can see here, we printed our user local share. 64 00:04:12,310 --> 00:04:16,930 So that is called the Pathname expansion of a hidden files. 65 00:04:16,930 --> 00:04:21,610 So as we know, files that begin with a period, characters are hidden. 66 00:04:21,610 --> 00:04:30,190 So a pathname expansion also respects this behavior and expansion such as this here echo this asterisk. 67 00:04:30,220 --> 00:04:33,700 This will not reveal hidden files. 68 00:04:33,700 --> 00:04:38,380 So it might appear at first glance that we could include hidden files in an expansion, for example, 69 00:04:38,380 --> 00:04:44,830 like this that starts with this, uh, by starting a pattern with a leading period like this. 70 00:04:44,830 --> 00:04:47,960 And as you can see here, we got it. 71 00:04:47,960 --> 00:04:49,100 But it almost works. 72 00:04:49,100 --> 00:04:56,060 However, if we examine the results closely, we will see that the names from that starts with dot and 73 00:04:56,060 --> 00:04:56,600 double. 74 00:04:56,600 --> 00:05:05,300 That here will also appear in the results because these names refer to the current working directory 75 00:05:05,300 --> 00:05:06,710 and its parent directory. 76 00:05:06,740 --> 00:05:11,150 Using this pattern will include will likely produce an incorrect result. 77 00:05:11,150 --> 00:05:14,410 So we can see this if we try this command here. 78 00:05:14,420 --> 00:05:15,230 Clear. 79 00:05:15,350 --> 00:05:16,190 Oops, clear. 80 00:05:16,190 --> 00:05:21,650 And here we will list the and wildcard operator. 81 00:05:21,650 --> 00:05:26,300 After that we will use pipes and less here. 82 00:05:26,300 --> 00:05:30,800 And as you can see here, we got this our desired results here. 83 00:05:30,800 --> 00:05:32,600 So actually, let's end this. 84 00:05:34,040 --> 00:05:34,370 Oops. 85 00:05:37,710 --> 00:05:38,490 Here. 86 00:05:41,610 --> 00:05:43,720 Oh, can we change this color? 87 00:05:43,740 --> 00:05:47,730 I didn't realize that we can change the color of this. 88 00:05:50,240 --> 00:05:51,020 Here. 89 00:05:52,750 --> 00:05:53,200 Yeah. 90 00:05:53,200 --> 00:05:53,920 Let's. 91 00:05:54,840 --> 00:05:55,250 Quit. 92 00:05:55,440 --> 00:05:57,020 So whatever here. 93 00:05:57,030 --> 00:06:02,190 Now we're going to use this echo and echo dot. 94 00:06:02,950 --> 00:06:04,120 Braces. 95 00:06:06,150 --> 00:06:07,470 And here asterisk. 96 00:06:07,500 --> 00:06:10,890 And as you can see here, the event not found. 97 00:06:10,920 --> 00:06:12,530 We got an error here. 98 00:06:12,540 --> 00:06:17,340 So this pattern here, echo and as you can see here, this. 99 00:06:18,680 --> 00:06:27,920 So this pattern expands into every file name that begins with only one, followed by another characters. 100 00:06:27,920 --> 00:06:30,800 So this will work correctly with most hidden files. 101 00:06:30,800 --> 00:06:36,710 So it will it will not include file names with multiple leading periods and the LS command. 102 00:06:36,710 --> 00:06:40,550 With this a option uppercase. 103 00:06:40,550 --> 00:06:45,320 A option will print this to print that. 104 00:06:46,680 --> 00:06:47,310 Uh, so. 105 00:06:48,940 --> 00:06:49,880 And we will. 106 00:06:49,900 --> 00:06:54,460 And as you can see, we got an correct listing of a hidden files. 107 00:06:54,460 --> 00:06:56,110 So I'm waiting you in next lecture.