1 00:00:06,630 --> 00:00:09,210 - So what is a shell script all about? 2 00:00:09,210 --> 00:00:10,380 Well, a shell script 3 00:00:10,380 --> 00:00:12,240 can be as simple as the number of commands 4 00:00:12,240 --> 00:00:14,280 that are sequentially executed. 5 00:00:14,280 --> 00:00:15,750 It's to automate your job 6 00:00:15,750 --> 00:00:17,550 and to make it a little bit easier for you 7 00:00:17,550 --> 00:00:18,663 to get things done. 8 00:00:19,620 --> 00:00:21,510 Scripts normally work with variables 9 00:00:21,510 --> 00:00:24,660 to make them react differently in different environments. 10 00:00:24,660 --> 00:00:26,430 And when we talk about variables, 11 00:00:26,430 --> 00:00:29,520 think about the path variable, for instance, 12 00:00:29,520 --> 00:00:31,080 which is a system variable, 13 00:00:31,080 --> 00:00:33,690 or an environment variable as we call it. 14 00:00:33,690 --> 00:00:35,040 And by referring to it, 15 00:00:35,040 --> 00:00:38,610 you can dynamically use values 16 00:00:38,610 --> 00:00:41,220 that are different in different locations 17 00:00:41,220 --> 00:00:43,680 and also in scripts conditional statements 18 00:00:43,680 --> 00:00:46,470 such as fur, if, case, and while can be used 19 00:00:46,470 --> 00:00:48,390 to make it more flexible. 20 00:00:48,390 --> 00:00:49,800 So shell scripts are common 21 00:00:49,800 --> 00:00:51,900 as they are easy to learn and implement, 22 00:00:51,900 --> 00:00:54,900 and they are a part of the Linux operating system. 23 00:00:54,900 --> 00:00:57,240 Also, a shell will always be available 24 00:00:57,240 --> 00:01:00,060 to interpret code from the shell script. 25 00:01:00,060 --> 00:01:02,670 If the scripts use internal commands only, 26 00:01:02,670 --> 00:01:05,490 they are very fast as nothing needs to be loaded. 27 00:01:05,490 --> 00:01:08,850 Everything is already in memory if it's a bash command, 28 00:01:08,850 --> 00:01:11,910 and there is no need to compile anything. 29 00:01:11,910 --> 00:01:15,030 There are also no modules to be used in the bash script, 30 00:01:15,030 --> 00:01:17,370 and that makes them rather static. 31 00:01:17,370 --> 00:01:20,700 Also, bash shell scripts are not item potent. 32 00:01:20,700 --> 00:01:22,410 So shell scripts are very nice, 33 00:01:22,410 --> 00:01:25,440 but in some cases, you might want to use something else 34 00:01:25,440 --> 00:01:27,780 like Python or like Ansible 35 00:01:27,780 --> 00:01:29,883 if it's about configuration management.