Linux Bash Shell Scripting: Complete Guide (incl. AWK & SED)

Linux Bash Shell Scripting: Complete Guide (incl. AWK & SED)
Linux Bash Shell Scripting: Complete Guide (incl. AWK & SED)

English | MP4 | AVC 1280×720 | AAC 48KHz 2ch | 7.5 Hours | 1.73 MB
eLearning | Skill level: All Levels


Learn Linux shell scripting, go from ZERO to HERO and let’s dance your bash programming skills

Welcome to linux bash shell scripting course. I’am Richard and I will be your instructor. I have great knowleadge about shell scripting as throughout my carrer I had been working for Fortune 50 company, where I apart from taking care of 200+ Solaris servers wrote many scripts for keeping live easy

What is covered?

  • Basics of scripting – no worry you don’t know anything about scripting by now
  • Sha-bang explanation – what it is and why the heck it is called sha-bang
  • Decision making
  • Regular expressions
  • Wildcards
  • For & While loops
  • Functions
  • Reading arguments using CASE structure
  • …and many more

And what about AWK? Yes, it is covered here! And what about SED? Also covered!

Why I have created this course?

Many years back, when I was starting as UNIX administrator, I had many ideas how to improve specific things using scripts. But, I couldn’t find any good resource, which would take me through all needed topic in one place. Somewhere I got great explanation about sha-bang while regular expressions for shell scripting were only mentioned. Somewhere was good explanation about decision making in if statement, but SED and AWK part was missing, and that use of SED and AWK was in my carrer really important. Basically I cannot imagine any single production script, where I wouldn’t used SED or AWK, because without them you are not able to create that “magic” in your script.

Many years later, I am here to share in one place what is really needed in order to create magic script. Not only how to create script, do some decision making in if statements, write functions, use arrays, but mainly how to combine everything including AWK and SED. I was creating this course in a way, which would help me a lot to create great scripts during start of my career. All needed things in one place.

What you’ll learn

  • Be able to create PRO looking script with parameters
  • Use functions in script
  • Read files line by line using while loop
  • Use math in scripts
  • Be able to decide if value of specific variable is a regular file or a directory
  • Store commands output into an array
  • Be able to do decision making based on match with regular expressions
  • Use SED and AWK to take your scripts into next level
+ Table of Contents

Basics of scripting
1 Scripting – what it is all about
2 Math calculation
3 Math Calculation – showcase
4 Playing with $ arguments, arguments, arguments
5 More on arguments – playing with IFS and assigning arguments value to a variable
6 Redirection and Piping
7 Redirection and Piping – showcase
8 Exit status
9 Invoking the script
10 Sha-bang!
11 Using variables in scripts
12 Explicit definition – showcase
13 Read command
14 command substitution + time measurement

IF statement & Decision making
15 Explaining IF
16 Regular expressions – is there any reachable ip address
17 Filesystem related tests
18 Filesystem related tests – testing files permissions
19 && and – making IF statement shorter
20 Mathematical comparisons
21 String comparisons
22 String comparison – you are not root
23 Wildcards
24 Wildcards – making linux command badass
25 Wildcards – create backup script
26 Regular expressions

For loop
27 Explaining for loop
28 Add commands output into all .txt files
29 Looping through all script arguments [email protected] or $

While loop
30 Explaining while loop
31 Making own cat command with line numbering

CASE
32 Explaining case
33 Recheck users input
34 Creating script with parameters [-f file] [–file file] [-h] [–help]
35 (NEW) Manual Parsing vs Getopts vs Getopt
36 (NEW) Getopts – showcase script
37 (NEW) Getopt – showcase script

Arrays
38 Explaining Array
39 Array – storing output of command into array and making some fun with its items

Functions
40 Explaining Functions
41 Making addition in a function

AWK
42 Explaining AWK
43 if-else
44 for loop
45 Building script with AWK
46 AWK script PART 1 – reading arguments
47 AWK script PART 2 – was the location set
48 AWK script PART 3 – searching for specific extension
49 AWK script PART 4 – what about not existing extension
50 AWK script PART 5 – counting size of files using awk
51 AWK script PART 6 – setting largest and smallest file
52 AWK script PART 7 – printing statistics
53 print, BEGIN{}, {}, END{}
54 AWK script PART 8 – reading awk part from separate file
55 $1, $2, dollars everywhere
56 searching pattern
57 NF – number of fields
58 NR – number of records
59 FS – field separator
60 RS – record separator
61 variable assignment

SED
62 Explaining SED
63 Explaining s – substitute command
64 s – substitute command showcase
65 Building script with SED
66 SED script PART 1 – structure for reading arguments
67 SED script PART 2 – fixing spacetab issues
68 SED script PART 3 – printing lines which don’t have spacetab issues
69 SED script PART 4 – line numbering
70 SED script PART 5 – show spacestabs as a red background
71 SED script PART6 – show spacestabs also at the end of lines
72 SED script PART 7 – just to print it nicely
73 p – print command and -n option
74 a append i prepand
75 d – delete command
76 c – change command
77 q – quit command
78 e option Run multiple sed commands
79 i option Changing files for sure
80 e – perform shell commands

Sources
81 scripts