1 00:00:00,960 --> 00:00:03,300 OK, now let's start with environment variables. 2 00:00:03,660 --> 00:00:10,140 Now, when you open a terminal window and you bash process, which has its own environment, variables 3 00:00:10,140 --> 00:00:17,310 is initialized and these variables are form of global storage for various settings inherited by any 4 00:00:17,310 --> 00:00:20,580 application that are run during that terminal session. 5 00:00:21,120 --> 00:00:22,830 So opening the terminal here? 6 00:00:23,550 --> 00:00:27,390 OK, I want to increase the font size a little bit. 7 00:00:28,080 --> 00:00:28,620 OK. 8 00:00:29,520 --> 00:00:36,450 It's clear the screen now here we have the first environment variable, which called the best, and 9 00:00:36,450 --> 00:00:37,320 we already saw it. 10 00:00:37,740 --> 00:00:44,190 So I will use the eco command and what there are saying and the name of the variable. 11 00:00:44,550 --> 00:00:49,290 And this is not just the variable, it is environment variable, which means it is for the system. 12 00:00:49,770 --> 00:00:51,770 So he called Beth here. 13 00:00:51,780 --> 00:00:57,690 It will start showing us the bath where clinics will start looking to check for comments. 14 00:00:58,230 --> 00:01:03,600 We have other environment variables like the user so equal user. 15 00:01:04,200 --> 00:01:07,830 Here it will show us what is the current user, which is Kelly. 16 00:01:08,070 --> 00:01:11,160 And by the way, we can see that from here, which is Kelly. 17 00:01:12,260 --> 00:01:19,370 We can see the working directory, so by typing the BWT, we know that we are inside home canning now 18 00:01:19,370 --> 00:01:25,430 we can use Eco Star or Dollar Sign BW Rd, it would show us Home Kelly as well. 19 00:01:26,000 --> 00:01:26,410 OK? 20 00:01:26,900 --> 00:01:32,840 Also, we can use another environment variable, which is home. 21 00:01:33,500 --> 00:01:37,310 This is the home directory for the current user, which is home. 22 00:01:38,270 --> 00:01:41,600 As we saw, OK, by the way, we are inside the tilde. 23 00:01:41,720 --> 00:01:45,050 That's why bwt, it will show us the same value. 24 00:01:45,060 --> 00:01:47,390 So if I go, for example, to desktop. 25 00:01:47,760 --> 00:01:53,960 OK, now if I type B, it will print the working day to read Please don't get confused, OK, be ready 26 00:01:53,990 --> 00:02:02,390 or equal that p wd it would show us home Kelly Desktop, which is where is the current directory or 27 00:02:02,390 --> 00:02:04,520 print working directly or the current directory? 28 00:02:05,680 --> 00:02:06,280 Which is here. 29 00:02:06,910 --> 00:02:07,330 All right. 30 00:02:07,690 --> 00:02:13,780 But eco home, it will show us the home directory for the current user, which is kidding. 31 00:02:14,040 --> 00:02:18,700 Now what if we want to create a new variable inside the bash? 32 00:02:18,970 --> 00:02:20,410 So first, let's clean the screen. 33 00:02:20,740 --> 00:02:25,030 I want to declare this variable VAR one equal. 34 00:02:25,390 --> 00:02:27,940 For example, one six eight. 35 00:02:29,500 --> 00:02:32,530 For example, it's split inside that Google dot com. 36 00:02:32,780 --> 00:02:34,150 OK, Google dot com. 37 00:02:34,540 --> 00:02:34,980 All right. 38 00:02:35,560 --> 00:02:42,940 So if I type equal dollars sign VAR one, it will show us Google dot com. 39 00:02:43,390 --> 00:02:51,760 But if I type, or if I open a new terminal or control shifting and and if I type eco VAR one again. 40 00:02:52,660 --> 00:02:53,110 OK. 41 00:02:53,410 --> 00:02:54,580 It would show us nothing. 42 00:02:54,670 --> 00:02:55,150 Why? 43 00:02:55,180 --> 00:03:00,050 Because we open a new chairman session, so this variable is inside the current process. 44 00:03:00,070 --> 00:03:07,690 So again, if I type Bash Command and Bash Command here is to open a new bash inside this process, 45 00:03:07,690 --> 00:03:12,260 so it will be considered as a process if I type eco VAR one. 46 00:03:12,910 --> 00:03:14,130 It will show us nothing. 47 00:03:14,440 --> 00:03:20,020 So how to make this very available for all the sub processes? 48 00:03:20,560 --> 00:03:23,140 Well, first this button the exit command. 49 00:03:23,170 --> 00:03:26,620 This is to exit from the current situation or by typing control. 50 00:03:27,370 --> 00:03:28,360 OK, so at the exit. 51 00:03:28,900 --> 00:03:32,800 Now, if I type Eq. again, you can see that it is Google Dot com. 52 00:03:33,460 --> 00:03:36,610 No, I will use command called export. 53 00:03:37,450 --> 00:03:40,600 So this export VAR one equal. 54 00:03:41,590 --> 00:03:44,980 YouTube dot com, for example. 55 00:03:45,990 --> 00:03:49,300 If I type equal born this time, it would be YouTube dot com. 56 00:03:49,620 --> 00:03:51,970 Now if I open a new bash, OK? 57 00:03:52,040 --> 00:03:54,060 Busted ring or a process? 58 00:03:54,360 --> 00:03:58,950 If I thought it could bar one, it will be here, which is YouTube dot com. 59 00:03:59,370 --> 00:04:01,110 OK, so far, so good. 60 00:04:01,350 --> 00:04:07,170 Now, if I type control D or exit clear the screen eco bar one. 61 00:04:07,410 --> 00:04:14,940 Yeah, YouTube dot com is still here, so we will use export command for such things to have this variable 62 00:04:15,390 --> 00:04:16,800 for all the sub processes. 63 00:04:17,170 --> 00:04:19,470 Alright, now what is the use of the variable? 64 00:04:19,560 --> 00:04:22,770 Of course, we can use it in scripting out of sync. 65 00:04:23,040 --> 00:04:26,190 So for example, Bing, then I sign over one. 66 00:04:26,520 --> 00:04:29,460 This will start bringing YouTube dot com. 67 00:04:30,360 --> 00:04:35,790 But again, don't do this on life targets by the way of being will not do anything harmful. 68 00:04:36,090 --> 00:04:43,800 But please don't do any scanning or any any sense, whatever on life targets, because you may get in 69 00:04:43,800 --> 00:04:44,190 trouble. 70 00:04:44,700 --> 00:04:46,260 Now we have special variables. 71 00:04:46,580 --> 00:04:47,700 First is the screen. 72 00:04:48,060 --> 00:04:51,000 The first one, which is equal, though don't sign dollar sign. 73 00:04:51,720 --> 00:04:57,050 So here it will bring us the current process ID or ID. 74 00:04:57,420 --> 00:04:58,560 So the current ID. 75 00:04:59,720 --> 00:05:08,270 Opted for this bash, terming that process is like this, no, OK, one thousand one hundred five. 76 00:05:09,540 --> 00:05:14,460 So to make sure open a new bash, no type equal, they're not saying they're not sane. 77 00:05:15,180 --> 00:05:15,810 You can see that. 78 00:05:15,850 --> 00:05:23,790 Oh, it is different, which means this is another bash process as a separate process inside this batch 79 00:05:23,820 --> 00:05:24,270 process. 80 00:05:24,540 --> 00:05:27,450 And it would show us that pretty well. 81 00:05:27,560 --> 00:05:28,860 So we have the equal. 82 00:05:29,040 --> 00:05:35,520 So first, the split from dispatch, clear screen equal, then up sign and question mark. 83 00:05:35,970 --> 00:05:44,670 So this to tell us what is the status of the last running comment so that it's zero, which means it 84 00:05:44,670 --> 00:05:45,840 is run successfully? 85 00:05:46,110 --> 00:05:49,320 Other than that, it will be considered filled. 86 00:05:49,560 --> 00:05:51,210 So for example, let's put this command. 87 00:05:51,210 --> 00:05:52,080 This is not the command. 88 00:05:52,110 --> 00:05:52,800 This is an error. 89 00:05:52,950 --> 00:05:54,240 As you can see, command not found. 90 00:05:54,510 --> 00:06:00,810 If I type equal the last question mark, it would be one hundred twenty seven, which means there was 91 00:06:00,810 --> 00:06:01,320 an error. 92 00:06:01,830 --> 00:06:07,830 OK, but if I run again, if I run it again, what is the last command which is equal that I sign? 93 00:06:07,980 --> 00:06:09,300 So this will be zero? 94 00:06:09,600 --> 00:06:10,430 All right, good. 95 00:06:10,470 --> 00:06:11,400 So far, so good. 96 00:06:12,330 --> 00:06:15,840 So this will give us the status of the last running command. 97 00:06:15,870 --> 00:06:20,330 If it is zero, which means successful, other than that, it will be considered failed. 98 00:06:21,120 --> 00:06:22,890 Now to see all the variables. 99 00:06:23,310 --> 00:06:25,620 So for example, we have that VAR one. 100 00:06:25,730 --> 00:06:27,480 Remember or VAR one here. 101 00:06:27,870 --> 00:06:34,410 So to see all the environmental variables or the variables run the command and so on, run it like that. 102 00:06:34,710 --> 00:06:40,020 And you can see that here is all of the commands are here or the variables. 103 00:06:40,020 --> 00:06:40,320 I mean. 104 00:06:40,800 --> 00:06:41,250 OK. 105 00:06:41,460 --> 00:06:43,620 So you can see that, yeah, VAR one it is here. 106 00:06:43,980 --> 00:06:46,240 VAR one equal YouTube dot com. 107 00:06:46,590 --> 00:06:51,840 So all of the environment variable that are here inside that the bash process will be here. 108 00:06:52,110 --> 00:06:58,890 OK, now if I quit again from it, from the process, if I run it again, this increase the font size 109 00:06:59,550 --> 00:07:02,610 equal VAR one you can see, Oh, it is not here. 110 00:07:03,390 --> 00:07:03,750 OK. 111 00:07:04,320 --> 00:07:06,540 If I type in the same thing. 112 00:07:07,690 --> 00:07:08,830 Warren is not here. 113 00:07:08,860 --> 00:07:11,260 As you can see, why is that? 114 00:07:11,410 --> 00:07:13,090 We will talk about this later on. 115 00:07:13,330 --> 00:07:18,730 There is something called the bash RC, OK, here. 116 00:07:19,180 --> 00:07:25,450 So I was on this command at the cat that bash our see here we can. 117 00:07:25,450 --> 00:07:31,900 But whatever variables, then it would be exported each time we run the bash program or Tanami. 118 00:07:32,170 --> 00:07:34,420 Don't worry, we will talk about this in detail later on. 119 00:07:34,750 --> 00:07:36,160 For now, keep that in your mind.