Choose your language:

Hong Kong
New Zealand
United Kingdom
United States

Intro to Bash Shell Programming

Course Code



3 Days

Completion of an Introduction to UNIX/Linux or similar course, and six months of command line experience on a UNIX/UNIX-like operating system. Programming skills are not required, but are helpful.
This course provides participants with training to enhance their skills utilizing the techniques presented through classroom problem solving and controlled online workshops. Participants are invited to bring their current ideas and questions to the classroom for discussion. Case studies, lecture, group problem solving, and online laboratories will be used. Participants will be encouraged to enhance their skills utilizing the techniques presented through classroom problem solving and controlled online workshops.
This course is designed for individuals requiring a mastery of the command line interface to the UNIX operating system. This includes system administrators, programmers, and power users.

Upon completion of this course, participants will be able to write Bash Shell scripts using the following features and more:

  • I/O redirection, pipes, and command and variable substitution
  • Passing parameters to shell scripts and interpreting their meaning
  • Controlling the program flow using conditionals and loops
  • Catch and interpret Control-C and other signals
  • Apply debugging techniques to locate coding errors
What is UNIX?
What is Linux?
Open Source vs. Free Software vs. Public Domain
Linux Components
A Historical Overview
Linux Features
Linux Programming Support

UNIX/Linux Basics Note
Accessing the System
Issuing Commands
Control Keys
Command Syntax
Online Documentation
Changing Your Password
Logging Out

Using Files and Directories Note
Characteristics of Linux Files
File System Hierarchy
Working With Directories
Listing Directory Contents
More Directory Listing Examples
Linux System Directories
Special Files
Manipulating Files
Managing Files
Permission Examples
Permission-setting Shorthand
The umask Command

Bash Shell Basics
Linux Components
I/O Redirection
Examples of Redirection
Using Pipes
Wildcards For Filenames
Command Substitution
Variable Substitution
Introducing Shell Scripts
Quoting To Prevent Interpretation
Examples of Quoting
Command Parsing Order
Special Shell Scripts

Process Management
Process Structure
Monitoring Running Processes
Process Creation
Shell Script Execution
Process Priorities
Modifying the NICE Bias
Background Processes and nohup
Killing Processes

Regular Expressions Note
The grep Command
Simple metacharacters
Advanced metacharacters
Extended metacharacters
The sed Command
Greedy Matching in sed
An Example of awk

Data Tools, Part I Note
The cat Command
head and tail
expand and unexpand
cut and paste
The find Command

Bash Scripts: Background
Why Shell Programming?
Steps to Creating a Script
Menu Building -- Example Using select
Comments in Shell Scripts
Using Single-Value Variables
Working With Arrays
Parameter Expansion Modifiers
How to Correctly Display Error Messages
Performing Arithmetic (let and (( )))
Using expr For String Matching
Interactive Scripts (the read Command)

Bash Scripts: Flow Control
The if Command
Test Operations (test, [ ], and [[ ]])
The while Loop
The for Loop
Changing the Script Parameters (set)
Loop Control (break and continue)
The case Command
Exiting a Shell Script
Menu Building -- Complete Example

Bash Scripts: User Interaction (as time permits)
Using getopts For Handling Command Line Options
The trap Command
Setting Runtime Options in the Bash Shell

Bash Scripts: Efficiency (as time permits)
Subshells and IO Redirection (( ), { }, and exec)
Conditional Execution (&& and ||)
Temporary Files With mktemp
Floating Point Arithmetic
HERE Documents
Shell Functions

Appendix -- Using Bash Interactively
Bash Shell Background
Automatic Configuration
Command History
Command Prompt Customization
Command Line Editing
Other Set Options
Aliases (Command Macros)
Environment Variables
Example Startup Scripts

Appendix -- Data Tools, Part II
Using xargs for Efficiency
Finding Differences -- diff
Side-by-Side Differences -- sdiff
Character Translation -- tr
Sorting Text Files -- sort
Relational Joins -- join

Send Us a Message
Choose one