Learn Bash Shell Scripting for Automation

Video description

Bash shell scripting is a programming language to automate tasks and interact with the operating system in Unix/Linux. It allows users to write scripts that execute commands, make decisions based on conditions, and manipulate data. Using variables, loops, and functions, users can create powerful scripts to streamline repetitive tasks, manage system configurations, and improve system automation efficiency.

The course elaborates on Bash shell scripting in Unix/Linux environments. The course covers basic shell script writing to advanced automation techniques. You will learn about environment setup, variable handling, conditional statements, loops, and functions. The course delves into essential Unix filters such as grep, awk, and sed to manipulate data. It covers working with remote servers, interacting with REST APIs, and handling regular expressions. With practical projects and real-world examples, you will gain hands-on experience in automating tasks, enhancing productivity, and becoming proficient in Linux/Unix administration and automation.

Upon completion, you will be skilled in Bash scripting for Unix/Linux environments, automated tasks, managing configurations, and manipulating data effectively. The course covers conditional statements, loops, functions, and practical projects, providing hands-on experience.

What You Will Learn

  • Write and execute Bash shell scripts in Unix/Linux environments
  • Utilize filters such as grep, awk, and sed for data manipulation
  • Apply conditional statements, loops, and functions for decision-making
  • Interact with remote servers and REST APIs
  • Use regular expressions for text pattern matching
  • Practical projects enhance Linux/Unix administration and DevOps skills

Audience

The course is aimed at professionals in Unix/Linux environments to become proficient in Bash shell scripting, suitable for automation engineers, system administrators, DevOps engineers, software developers, database administrators, AWS cloud administrators, and IT professionals with basic knowledge of Linux/Unix commands. Basic knowledge of Linux/Unix commands is required for this course. No experience in Bash shell scripting is necessary, making it suitable for beginners. You should have access to a Unix-like OS (Linux, Unix, macOS) to practice the concepts taught in the course.

About The Author

VRTechnologies: VRTechnologies is a seasoned DevOps automation consultant with a specialization in cloud and DevOps. With a wealth of experience, they have successfully trained over 400 students through comprehensive automation courses covering Shell, Python, and Ansible.

With six years of training expertise, VRTechnologies’ commitment to staying at the forefront of technology trends is unmatched, ensuring that students receive the most up-to-date knowledge. Their passion for learning and teaching drives them to meticulously research and prepare each course, offering hands-on demonstrations from the basics to advanced concepts. Join VRTechnologies on a transformative learning journey and unlock the power of automation in your career.

Table of contents

  1. Chapter 1 : Introduction
    1. Introduction
    2. Prerequisites to the Course
    3. Who Can Enroll in This Course?
  2. Chapter 2 : Environment Setup to Practice with Bash Shell Scripting
    1. Environment Setup to Practice with Bash Shell Scripting
    2. Installing Any Linux Distribution And CentOS on Windows with WSL
    3. Enabling systemctl on WSL CentOS
    4. Configuring Gmail Setup on CentOS
    5. Accessing Windows Files from WSL Centos or WSL CentOS Files from Windows
    6. Basic Steps to Write and Execute a Bash Shell Script
    7. Different Ways to Execute a Shell Script
    8. How to Use CentOS Terminal on Visual Studio Code Editor
    9. chmod Command Won't Work by Default on WSL Linux
    10. Install Tools Such as Docker, Ansible, Java, nginx, and httpd with a Bash Script
  3. Chapter 3 : Basic Understanding of Bash Shell Scripting
    1. Basic Understanding of Shell Script Execution
    2. Usage of Semicolon; in Bash Shell Scripts
  4. Chapter 4 : Variables
    1. Introduction to Variable: What Is Variable and Define Variables with Differences
    2. Default Value of a Variable and How to Unset or Clear or Delete Variable Values
    3. Types of Variables
    4. Rules to Define Variables
    5. What Is a Syntax in Bash Shell Scripting
  5. Chapter 5 : Inputs and Outputs
    1. Inputs and Outputs for Variables in Bash Shell Scripting
    2. Echo Command and Basic Usage of the Echo Command
    3. Practice with Variables and Echo Command
    4. Link Windows Path to Non-Root User Home of WSL OS
    5. Echo Command with Options Part-2
    6. How to Get the Colorful Output from Bash Shell Scripts
    7. Read Command
    8. Source Command to Read Inputs for Variables
    9. Export Command to Provide Inputs for Variables
    10. Command-Line Arguments to Provide Inputs for Variables of Bash Shell Script
    11. Shift Command with Command-Line Arguments
  6. Chapter 6 : String Operations
    1. Basic Operations on String
    2. String Operations on Paths
  7. Chapter 7 : Arrays
    1. Introduction to Arrays
    2. Accessing Array Elements and Operations on Arrays
    3. Why We Need Arrays
    4. How to Provide Inputs for Arrays
  8. Chapter 8 : Bash Dictionaries | Bash Associative Arrays
    1. Introduction to Bash Dictionaries
  9. Chapter 9 : Basics of Commands
    1. Exit Status of a Command
    2. Redirection Operators and STDIN, STDOUT, and STDERR
    3. How to Execute Any Command with the Help of a Variable?
    4. How to Use the Cut Command to Get Required Columns/Fields and Characters
    5. How to Use an awk Command to Get the Required Filed/Column or Line
    6. Basics of grep Command
    7. How to Use Variables in grep Command?
    8. Introduction to sed Command and Usage of Variables
    9. sed Command with Find and Replace | How to Use Different Delimiters in sed
    10. sed Command with Inserting and Deletion of Lines Using Line Numbers and Search
    11. Best Example to Use the tr Command with Cut and Then with kill-9
    12. Arithmetic Operations for Integers and Floating Point Numbers
  10. Chapter 10 : Working with Command-Chaining Operators
    1. List of Command-Chaining Operators
    2. Command-Chaining Operator - Pipe
    3. Command-Chaining Operator - Semicolon
    4. Command-Chaining Operators - Logical AND and OR
    5. How to Find the Location or Path of Any Command or Installed Package
    6. Shell Script to Get the Location of Any Package
    7. Executing the Block of Code
    8. Simple Practice
    9. How to Get the Latest File or Directory from the Current Location
  11. Chapter 11 : Test Command and Conditional Statements
    1. How to Use the Test Command to Validate a Condition
    2. Exit Command and Its Usage
    3. Introduction to If and If-Else Statements
    4. Debugging a Bash Shell Script
  12. Chapter 12 : Shell Scripting Practice
    1. Write a Shell Script to Read a Given File Content
    2. Write a Shell Script to Install Packages Using Yum
  13. Chapter 13 : The if, elif, elif else, and Case Statements
    1. The if, elif, and elif else Statements
    2. Case Statement
    3. Write a Shell Script to Find the Version for a Given Tool
    4. Shell Script to Send All DevOps Tools Information to Mail
  14. Chapter 14 : Scheduling Jobs
    1. Scheduling Jobs with at Command
    2. Scheduling Jobs with crontab
  15. Chapter 15 : Comments and Logging
    1. Comments and Logging
  16. Chapter 16 : Functions
    1. Introduction to Functions
    2. Defining a Function and Calling It with and Without Arguments
    3. How to Pass Strings or Text as an Argument
    4. Shell Script to Install Packages with Functions
    5. Scope of Variables
    6. How to Reuse Function in Different Shell Scripts
  17. Chapter 17 : Here Document and Here String
    1. Heredoc and Herestr
  18. Chapter 18 : Loops
    1. Introduction to Bash Loops with an Example
    2. For Loop Syntax and Its Usage
    3. Working with Arrays Using For Loop
    4. Simple Practice with For Loops
    5. Send an Automatic Mail Alert When the Secret File Is Deleted
    6. Break and Continue Statements
    7. While Loop Part-1
    8. While Loop Part-2
    9. Until Loop with Example
    10. Select Loop and Its Usage with an Example
    11. Practice for You
    12. While Loop with getopts Command to Read Arguments
  19. Chapter 19 : Working with REST APIs Using the Curl Command
    1. How to Validate the REST API Execution with the Curl Command?
  20. Chapter 20 : Working with Remote Servers
    1. Introduction to Work with Remote Servers
    2. Shell Script to Execute a Command on Remote Hosts Using When They Used SSH Keys
    3. How to Provide Password for ssh with sshpass? | There Are Three Ways
    4. Working with SCP to Transfer a File from the Local Server to the Remote Server
    5. How to Provide a Password for ssh or scp Using Expect Command?
  21. Chapter 21 : Real-Time Practice
    1. Monitor a Service(s) on the Host for Every Minute; If Not Running Then Send a Mail
    2. Shell Script to Monitor a Microservice with Its Health URL
    3. Monitor Application Log Directory | Alert If the Application Is Not Generating Logs
    4. Install the Required Git Version on the Host
  22. Chapter 22 : Regular Expressions | Regex
    1. Introduction to Regular Expressions or Regex
    2. Creation of Pattern or Extended Regular Expressions or ERE
    3. Write a Shell Script to Get the Latest Git Version from the git-scm Website
    4. Case Statement with Regex
  23. Chapter 23 : printf Command
    1. Concepts of printf Command

Product information

  • Title: Learn Bash Shell Scripting for Automation
  • Author(s): VRTechnologies
  • Release date: August 2023
  • Publisher(s): Packt Publishing
  • ISBN: 9781835080948