Automation with BASH Shell Programming

Automation with BASH Shell Programming

Instructor: Steve Ovens

Overview

Although UNIX Shell Programming is very traditional topic of computer science, it is key to successful projects in almost every new technology. Whether you want to perform repeated tasks in predictable manner or interested in automation, shell programming is your friend. In this shell programming course, you will learn many topics in this course as outlined below.

Learning Objectives/Outcomes

  • Understanding how shell scripts work and writing simple to complex shell scripts
  • Automating tasks under Linux/Unix
  • I/O Redirection, Variables
  • Using control structure in shell scripts
  • Using functions
  • Debugging shell scripts

Course Outline

Module 1: Introduction to Shell Scripting

  • What is a shell?
  • Types of shells available in UNIX systems
  • Why Use Scripts, How Scripts Help in improving efficiency, and automation.
  • Shell instantiation
  • Shell internal and external commands
  • Return codes
  • How Shell Works
  • Anatomy of a Shell Script
  • Commands, variables, and control structures.
  • Changing and Switching Shells

Module 2: Writing First Shell Program

  • Three steps of creating and executing shell scripts (script file, permissions, execution)
  • Comments and order of execution
  • Sub shells and scope of variables
  • Creating and exiting of sub shells.
  • Ways to Execute a Shell Script
  • Declaring Variables and default values
  • Variable Scopes
  • Special Variables
  • Using dot notation and source command.
  • Shell Environment Files
  • BASH Dos and Don’ts

Module 3: I/O Redirection and Pipes

  • Special Characters and Escaping them
  • Background and Foreground Processes
  • NOHUP & Disown
  • Standard Input, Output, and Error redirection
  • Pipes and filters
  • Redirecting output
  • Reading and writing to files

Module 4: Conditions

  • Braces, Brackets and Parentheses
  • Conditionals and Testing
  • Loops!
    • Breaks
    • Continues
  • Case Statements
  • Select Statements
  • Arithmetic and String comparisons
  • Logical operators
  • The if-else class of flow controls
  • The case structure
  • The while and until loops
  • Select statement
  • Exiting a control structure
  • Nesting

Module 5: Functions, Debugging, Arithmetic and String Comparison and Advanced Techniques

  • Comparisons
  • AWK and CUT for search and replace
  • Simple functions
  • Parameters
  • Exit codes
  • Return
  • Debugging the whole scripts with –x
  • Debugging parts of script with “set –x” and “set +x” within script.
  • Working with lists
  • Searching and replacing
  • Bash Tips and Tricks

Course Benefits

This course will enable you to write UNIX shell scripts to automate routine tasks, run commands at certain times and be more productive in your day-to-day life. Shell scripts, when used in combination with cron utility can significantly reduce manual work. If you are a programmer or a system administrator responsible for large number of machines, this course is for you.

Student Requirements

Basic knowledge of Linux operating system is required for this course. You should be running Linux either on your computer or a virtual machine. The easiest way of running virtual machine is installing it on Virtual Box. Basic knowledge of control structures like if-then-else is also a plus. You should know how to login to Linux and set permissions for files (use of chmod command on Linux).

What Students Should Bring

  • A laptop with Linux Operating System

What Students Will Be Provided With

  • Course material, examples

Instructor Bio

Steve is a dedicated IT professional and Linux advocate. Prior to joining Red Hat, he spent several years in financial, automotive, and movie industries. Steve currently works for Red Hat as an OpenShift consultant and has certifications ranging from the RHCA (in DevOps), to Ansible, to Containerized Applications and more. He spends a lot of time discussing technology and writing tutorials on various technical subjects with friends, family, and anyone who is interested in listening.

Date and Time

October 12, 2018

  • Morning session: 8:30 AM to 12 at noon
  • Lunch break: 12:00 to 1:00 PM
  • Afternoon session: 1:00 PM to 4:30 PM

Registration

Go to registration page to register for the training course and select “Ohio LinuxFest Institute Professional Pass”. During the registration process, you will get an option to select your training program.