lf logo
8245  Reviews star_rate star_rate star_rate star_rate star_half

Bash Programming

The Introduction to Bash Shell Scripting course teaches students to read, write, and debug Bash (Bourne Again Shell) scripts. Skills Gained Understand Unix processes and how to control them Learn how...

Read More
Course Code BASH-PROG
Duration 3 days
Available Formats Classroom

The Introduction to Bash Shell Scripting course teaches students to read, write, and debug Bash (Bourne Again Shell) scripts.

Skills Gained

  • Understand Unix processes and how to control them
  • Learn how to use and script the Bash shell
  • Master core Bash language constructs such as variables, loops, conditionals, and functions
  • Learn advanced Bash programming techniques
  • Debug Bash scripts

Prerequisites

All students should have basic knowledge of Unix or Linux, or have taken Accelebrate's Introduction to Linux for End Users class. Prior programming or scripting experience is helpful but not required.

Course Details

Introduction

Unix Processes

  • What is a Process?
  • Process Structure
  • The ps Utility
  • Options to the ps Utility
  • Background Commands (&)
  • Killing Background Processes
  • Redirecting the Standard Error

Getting Started

  • What is a Shell?
  • Running Scripts
  • Specifying the Script’s Interpreter
  • The PATH Environment Variable
  • Sub-shells

Variables

  • Shell Variables
  • The read Command
  • The export Command
  • The Shell Environment
  • Parameter Expansion
  • Command Substitution

The Login Process

  • The Login Process
  • The System Profile Script
  • Your .bash_profile Script
  • The . Command

Conditional Statements

  • The Exit Status of Commands
  • Command Line Examples
  • The test Command
  • The if-then-else Construct
  • The elif Construct
  • case Statements

Loops

  • The for Loop
  • The while Loop
  • break and continue
  • Reading Lines From Files
  • Using Arrays with Loops

Special Variables

  • $$ - PID of Shell
  • Command-Line Arguments
  • $# - Number of Arguments
  • $* - All Arguments
  • The shift Command
  • The set Command
  • Getting Options

Quoting Mechanisms

  • Single vs. Double Quotes
  • What is a Here Document?
  • Using a Here Document
  • Here Document Quoting
  • Ignoring Leading Tabs

Functions

  • Shell Functions
  • Passing Arguments to Functions
  • Returning Values from Functions
  • Function Declarations

Advanced Programming

  • Shell Arithmetic
  • The select Statement
  • Terminal Independence in Scripts
  • The eval Command

Debugging Techniques

  • Using echo
  • Bash Programming
  • Using Standard Error
  • Script Tracing
  • Options for Debugging
  • Conditional Debugging
  • Conclusion