1
00:00:03,540 --> 00:00:08,160
At the beginning of the course you started learning about the absolute necessities when it comes to

2
00:00:08,160 --> 00:00:09,380
shell scripting.

3
00:00:09,390 --> 00:00:13,830
You found out that it really doesn't matter what the final name of the shellscript is or what extension

4
00:00:13,830 --> 00:00:15,450
it has if any.

5
00:00:15,450 --> 00:00:20,480
The most important thing is its permissions and specifically the execute permission.

6
00:00:20,550 --> 00:00:25,530
You learn how to add executable permissions to your scripts with the chmod command.

7
00:00:25,740 --> 00:00:30,240
Once you started writing shell scripts you learned the importance of using a sharp bang on the very

8
00:00:30,270 --> 00:00:32,070
first line of your script.

9
00:00:32,100 --> 00:00:37,560
You also learned how to insert comments in your script you quickly started using variables to store

10
00:00:37,560 --> 00:00:39,660
values in your script.

11
00:00:39,660 --> 00:00:46,300
You use the echo shell built in to generate standard output including displaying the contents of variables.

12
00:00:46,440 --> 00:00:50,880
You learned that using single quotes around a string makes it a literal string.

13
00:00:50,880 --> 00:00:56,280
That means everything in the single quotes is displayed exactly as it appears in your shell script.

14
00:00:56,990 --> 00:00:59,600
What do you want to allow for variable expansion.

15
00:00:59,600 --> 00:01:02,040
You learned to use double quotes.

16
00:01:02,420 --> 00:01:08,540
You learned how to use the type command to determine if a command is a shell builtin or a Linux command

17
00:01:08,870 --> 00:01:10,310
to get help on a shell built in.

18
00:01:10,310 --> 00:01:18,570
You use the help Shaad built in command for Linux commands you learn how to use and read man pages.

19
00:01:18,680 --> 00:01:23,960
You also learned how to take advantage of some of the shell variables that you get for free when using

20
00:01:23,960 --> 00:01:25,130
bash.

21
00:01:25,130 --> 00:01:30,040
Some of the variables you've used included hostname random and you ID.

22
00:01:30,290 --> 00:01:35,840
We talked about command substitution and how the dollar sign parentheses syntax is the current favorite

23
00:01:35,840 --> 00:01:41,840
way to perform that command substitution while surrounding a command and back ticks is the older syntax

24
00:01:42,050 --> 00:01:45,120
that you may still encounter from time to time.

25
00:01:45,200 --> 00:01:50,060
You assign the output of commands to variables using this method as well as using the output of those

26
00:01:50,060 --> 00:01:53,560
commands directly or as part of other commands.

27
00:01:54,430 --> 00:01:59,380
Once you started creating scripts that had multiple steps and requirements you were introduced to the

28
00:01:59,380 --> 00:02:05,500
concept of pseudo coding which is simply a high level description of what your script will do.

29
00:02:05,500 --> 00:02:11,410
You then went back over your steps and filled in the exact commands and details required to make those

30
00:02:11,410 --> 00:02:14,040
steps function correctly.

31
00:02:14,090 --> 00:02:17,030
You also learn how to use an IF statement.

32
00:02:17,060 --> 00:02:23,240
We talked about how you can use expressions in operator supported by the test built in between the double

33
00:02:23,240 --> 00:02:25,450
brackets of the if statement.

34
00:02:25,460 --> 00:02:31,250
We also talked about the older syntax of using single brackets for conditional expressions.

35
00:02:31,250 --> 00:02:34,640
The use of the if statement brought us to exit statuses.

36
00:02:34,640 --> 00:02:39,800
That's because the if statement was checking to see if an expression was successful or not before it

37
00:02:39,830 --> 00:02:42,320
executed the appropriate code block.

38
00:02:43,010 --> 00:02:49,750
When a command completes successfully it returns an exit status of 0 when it doesn't it returns a non

39
00:02:49,750 --> 00:02:51,610
zero exit status.

40
00:02:51,620 --> 00:02:56,930
You learned how to control the exit status of your scripts by using the exit shell built in.

41
00:02:56,930 --> 00:03:02,390
You also learn how to check the exit status of the most recent command by examining the contents of

42
00:03:02,390 --> 00:03:03,700
the variable dollar sign.

43
00:03:03,700 --> 00:03:05,320
Question mark.

44
00:03:05,320 --> 00:03:08,840
You use the if statement to perform some sanity checking.

45
00:03:08,870 --> 00:03:11,320
Users don't always behave the way you want them to.

46
00:03:11,390 --> 00:03:17,180
And systems are not always configured exactly the same if something is required for your script to execute

47
00:03:17,180 --> 00:03:18,170
successfully.

48
00:03:18,170 --> 00:03:23,870
You learn that you have to check for it when you started using multiple options to various commands.

49
00:03:23,870 --> 00:03:29,870
We talked about how you can combine multiple single character options following just one hyphen for

50
00:03:29,870 --> 00:03:30,710
most options.

51
00:03:30,710 --> 00:03:36,080
The order doesn't matter so you can execute the same command in multiple ways and still get the exact

52
00:03:36,110 --> 00:03:37,230
same result.

53
00:03:37,940 --> 00:03:43,250
Also many commands give you the option of using a single character option or a longer version of that

54
00:03:43,250 --> 00:03:49,200
option when there are two forms of the same options such as dash and or dash dash name.

55
00:03:49,220 --> 00:03:52,290
You only need to use one of the forms.

56
00:03:52,460 --> 00:03:57,980
By the way all the variations of the ID command you see here on your screen are equivalent and produce

57
00:03:57,980 --> 00:04:05,960
the exact same output next to learn how to use the read shell builtin in order to capture standard input

58
00:04:06,140 --> 00:04:08,300
and store it in a variable.

59
00:04:08,300 --> 00:04:13,110
You then moved on to creating random data that you could use for account passwords.

60
00:04:13,160 --> 00:04:17,730
One way you did this was by taking advantage of the random shell variable.

61
00:04:17,810 --> 00:04:23,030
Another method you use to was to take the output of the data command and run it through a cryptographic

62
00:04:23,030 --> 00:04:27,870
hash function you then started working with positional parameters.

63
00:04:27,870 --> 00:04:32,970
You learn that arguments are what are supplied to your script and that parameters are what you use to

64
00:04:32,970 --> 00:04:35,630
store those arguments inside of your script.

65
00:04:35,640 --> 00:04:38,920
Not only did you learn about dollar $0 1 and so on.

66
00:04:39,030 --> 00:04:45,450
You learned about a few special parameters such as Dollar Sign asterisk dollar sign and sign and dollar

67
00:04:45,450 --> 00:04:51,060
sign pound sign because you can't always anticipate the number of arguments you use or may supply to

68
00:04:51,060 --> 00:04:51,930
your script.

69
00:04:51,960 --> 00:04:56,390
You use the for loop to loop through each of the positional parameters.

70
00:04:56,760 --> 00:05:01,320
You also learn how to create while loops while the test returns true.

71
00:05:01,380 --> 00:05:04,530
The code block between do and done will be executed.

72
00:05:04,530 --> 00:05:09,830
This means that during a while loop you'll want to change the thing being tested for in some way so

73
00:05:09,840 --> 00:05:15,250
that the condition eventually evaluates to false or you'll end up in an infinite loop.

74
00:05:15,600 --> 00:05:21,840
Finally you learn how to fully manipulate standard input standard output and standard error by using

75
00:05:21,930 --> 00:05:23,980
i o redirection.

76
00:05:24,030 --> 00:05:28,660
One of the first forms of IO redirection you used came in the form of a pipe.

77
00:05:28,860 --> 00:05:34,760
You took the standard output of one command and piped it as the standard input into another command.

78
00:05:34,950 --> 00:05:40,230
You were able to start with some output and by making small changes to a series of pipes you were able

79
00:05:40,230 --> 00:05:42,970
to put it in the exact format that you wanted.

80
00:05:43,860 --> 00:05:50,250
Next you covered IO redirection to and from files you learned that using a single greater than sign

81
00:05:50,250 --> 00:05:56,430
when redirecting will create a new file or overwrite the existing contents of a file if it already exists

82
00:05:57,120 --> 00:05:59,670
in order to append to a file without overwriting it.

83
00:05:59,670 --> 00:06:06,470
You use the double greater than sign syntax you redirected the contents of a file as standard input

84
00:06:06,650 --> 00:06:09,870
into a command by using the less than sign.

85
00:06:09,920 --> 00:06:15,740
You also learn how to send standard error to a file as well as how to send both standard output and

86
00:06:15,740 --> 00:06:17,770
standard error to a file.

87
00:06:18,110 --> 00:06:24,170
You continued working with pipes and learn how to send both standard output and standard error as standard

88
00:06:24,170 --> 00:06:32,280
input through a pipe by using the pipe ampersand syntax in order to conform to the convention of sending

89
00:06:32,280 --> 00:06:38,230
error messages to standard error you learn how to redirect standard output to standard error.

90
00:06:38,310 --> 00:06:42,830
You also learn how to discard output by sending it to the nolde device.

91
00:06:42,840 --> 00:06:47,440
I hope you realize how far you've come in a relatively short period of time.

92
00:06:47,670 --> 00:06:52,770
At this point you could easily go off and write all kinds of useful shell scripts.

93
00:06:52,770 --> 00:06:57,420
You know how to control the flow of your scripts you know about input and output redirection.

94
00:06:57,420 --> 00:07:03,840
You know how to perform loops you understand many shell scripting conventions and on and on.

95
00:07:03,840 --> 00:07:09,380
In short if you've completed this course you are so far ahead of most shellscript yours.

96
00:07:09,390 --> 00:07:12,510
However I encourage you to keep learning and practicing.

97
00:07:12,540 --> 00:07:18,450
Of course one of the best ways to do that is to use your skills to perform some real world work that

98
00:07:18,450 --> 00:07:19,890
you need to get done.

99
00:07:19,890 --> 00:07:25,980
Pick something that you need to automate or make easier be it something you do at home or at work.

100
00:07:25,980 --> 00:07:29,150
Finally I want to congratulate you on completing this course.

101
00:07:29,280 --> 00:07:33,190
It's so easy to start something yet so hard to finish it.

102
00:07:33,360 --> 00:07:34,350
If you've made it this far.

103
00:07:34,350 --> 00:07:37,850
Know that you're one of the few who see things through to the end.

104
00:07:37,860 --> 00:07:40,010
For that I really respect you.

105
00:07:40,050 --> 00:07:43,600
I wish you the best and I hope to see you in another one of my courses soon.
