Complete Bash Shell Scripting

Video description

Many organizations favor Bash scripts for executing shell commands, running and customizing administrative tasks, automating repetitive tasks, and performing many more Linux and Unix functions. Having Bash scripting skills will make you stand out from your peers and help you advance in your automation career. With this course, you will learn Bash shell scripting in detail and understand how to apply the acquired skills confidently in the real world.

Starting with an introduction to Bash shell scripting, the course takes you through the process of installing Ubuntu on Windows 10. You will also learn to install Docker on a Ubuntu server and understand the basic steps to write and execute shell scripts. Once you have become familiar with redirection operators and explored commands such as grep, cut, awk, tr, and tee, you will write a simple script to get to grips with using the echo command, variables, strings, comments, and debugging.

The course also covers input and output commands, arithmetic operators, conditional statements, arrays, and loops, and demonstrates how to schedule jobs. You will work with remote servers, functions, the printf command, and the sed command and discover what awk scripting is. Finally, you will put your knowledge to practice by designing a simple digital clock and automating multiple server inventory using shell scripts.

By the end of this course, you will have become well-versed in Bash shell scripting and developed the skills to automate repetitive tasks.

What You Will Learn

  • Write and execute shell scripts confidently
  • Discover how to create and use variables
  • Find out the role of a shebang line in shell scripting
  • Become familiar with basic and advanced shell scripting commands
  • Design an arithmetic calculator with shell script using the awk command
  • Execute different commands on different servers using shell scripts

Audience

Whether you are a beginner or an advanced-level automation engineer, or a Linux administrator looking to explore Bash shell scripting, this course is for you. A basic understanding of Unix or Linux commands is necessary to get started with this course.

About The Author

VRTechnologies: VRTechnologies is an IT Firm with 7+ years of experience in different domains. They are very interested in teaching new technologies and believe that the best way to learn is by doing it in a fun way. VRTechnologies have a good practical knowledge of automation with different scripting languages such as Shell scripting, Python scripting, and YAML scripting. Their classes focus on providing high-quality documentation with practical knowledge and believe a Hands-on experience in learning new technologies makes learning really interesting.

Table of contents

  1. Chapter 1 : Introduction
    1. Introduction to the Course
    2. Required Documents for This Course
    3. Environmental Setup to Practice Bash Shell Scripting
    4. Installing Ubuntu on Windows 10
    5. Basic Steps to Write and Execute a Shell Script
    6. List of General-Purpose Commands to Understand the Usage of a Command
    7. Configuring Gmail on an Ubuntu Server
    8. Docker Installation on an Ubuntu Server Using Bash Shell Script
  2. Chapter 2 : Redirection Operators
    1. Redirection Operators and Stdin, Stdout, and Stderr
  3. Chapter 3 : Commands to Read the File Content
    1. Commands to Read the File Content
    2. Commands to Read the File Content with Conditions
    3. How to Display or Print a Range of Lines
  4. Chapter 4 : Grep Command
    1. Basic Usage of the Grep Command
    2. Advanced Usage of the Grep Command
    3. Simple Practice with the Grep Command
  5. Chapter 5 : Cut Command
    1. Complete Cut Command in One Video
  6. Chapter 6 : Awk Command
    1. Basics of the Awk Command to Write Simple Shell Scripts
  7. Chapter 7 : Simple Useful Commands for Shell Scripting
    1. Tr Command
    2. Tee Command
  8. Chapter 8 : Basics of Shell Scripting
    1. First Simple "Hello World" Script Using the Echo Command
    2. Introduction to Variables
    3. Simple Shell Script to Know the Usage of Variables in Bash Shell Scripting
    4. Advanced Usage of the Echo Command
    5. Here Document for Multi-Lines or Multi-Line Block
    6. Using the Here Strings
    7. Writing Comments for a Shell Script
    8. What Is #!/usr/bin/env bash?
    9. Debugging a Bash Shell Script
    10. Exit Status of a Command
  9. Chapter 9 : String Operations to Write Bash Shell Scripting
    1. Basic String Operations
    2. String Operations on Paths | Useful for Real-Time
  10. Chapter 10 : Input and Output Commands for Bash Shell Scripting
    1. Inputting with the Read Command and Outputting with the Echo Command
    2. Inputting with the Command Line Arguments
  11. Chapter 11 : Arithmetic Operators
    1. Arithmetic Operators
    2. Simple Usage of the Case Statement
  12. Chapter 12 : Test Command, Commands Chaining, and Conditional Statements
    1. Test Command and Its Usage | Comparison and File Test Operators
    2. Command Chaining Using Logical AND () and Logical OR (||) Operators
    3. Executing a Block of Code Using {}
  13. Chapter 13 : Conditional Statements - Simple If, If-else, If-elif-else
    1. Simple If and If-else Conditional Statement
    2. Simple Shell Script to Verify if the User Is Root and if the User Has Sudo
    3. Shell Script to Start Docker Service
    4. Logical AND, OR, and NOT Operators - (, ||, and !)
    5. Differences Between [ ] and [[ ]] (Old and New Test Command) and Also (( ))
    6. If-elif-else Conditional Statement
    7. How to Handle the Command Line Arguments
  14. Chapter 14 : Scheduling Jobs with at and crontab
    1. One-Time Task Execution with At | Scheduling a Job with the At Command to Execute Once
    2. Scheduling Jobs with Crontab
    3. Shell Script to Send Automatic Mail Alert When RAM Memory gets Low
    4. Shell Script to Monitor File System Utilization with Mail Alerts
  15. Chapter 15 : Arrays of Bash Shell Scripting
    1. Introduction to Arrays
    2. Associative Arrays
  16. Chapter 16 : Loops and Loop Control Statements - Part 1
    1. Introduction to Loops
    2. Different Types of For Loop syntaxes
    3. Installing Multiple Packages with For Loop and Command Line Arguments
    4. Difference Between $@ and $*
    5. Loop Control Commands/Statements
    6. For Loop with Arrays
  17. Chapter 17 : Working with Remote Servers
    1. Login to a Remote Server from the Local Server Using SSH
    2. Executing Commands on a Remote Server without Logging into a Remote Server
    3. Providing a Password for SSH Using the sshpass Utility
    4. Executing Multiple Commands on Multiple Servers
    5. Shell Script to Execute Different Commands on Different Servers
  18. Chapter 18 : Loops and Loop Control Statements - Part 2
    1. Basic Syntaxes of While Loop
    2. While Loop with IFS
  19. Chapter 19 : Linux Functions
    1. Simple Introduction to Functions
    2. Defining a Function and Calling a Function
    3. Scope of the Variables (Global and Local Variables) and Returning a Variable Value
    4. Passing Parameters to a Function
  20. Chapter 20 : Complete Printf Command
    1. Complete Printf Command
  21. Chapter 21 : Awk Command and Awk Scripting
    1. Introduction to Awk
    2. Awk Command with Action and Basic Variables
    3. Introduction to Awk Scripting
    4. Awk Command with Options, Action, and Basic Variables
    5. Simple "Hello World" Awk Script
    6. How to Define a Variable, Display a Variable, and Execute Multiple Statements
    7. Awk Command or Awk Script: Reading Variable Values from the Command Line
    8. How to Use the Awk Command/Script in Shell Scripts
    9. How to Read Variables for the Awk Command Using a Shell Script
  22. Chapter 22 : Complete Sed Command
    1. Introduction to the Sed Command
    2. Sed: Viewing File Content and Deleting File Content Based on Line Numbers
    3. Searching File Content
    4. Find and Replace with the Sed Command
    5. Insertion and Deletion with the Sed Command
    6. Regex: Introduction to the Sed Command with Regex
    7. Regex - Part 1 - Regex with Special Characters (\s \t . *\+ \? and \)
    8. Regex - Part 2 - Regex with Special Characters (^ and $)
    9. Regex-Part-3: Regex with Special Characters ( [] () and {} )
    10. Simple Shell Script to Get All Git Versions from Official Git-scm Website
  23. Chapter 23 : Real-Time Practice (Low Level to High Level)
    1. Designing a Simple Digital Clock
    2. Automating a Server's Inventory Using Shell Script
    3. Automating Multiple Servers' Inventory Using Shell Script
    4. Monitoring File System Usage and Sending Mail Alerts
    5. Automating the Installation of the Required Git Version Using Bash Shell Script

Product information

  • Title: Complete Bash Shell Scripting
  • Author(s): VRTechnologies
  • Release date: November 2020
  • Publisher(s): Packt Publishing
  • ISBN: 9781800209695