Course Description
In this three-day hands-on course students learn how to read, write, and debug complex Bash shell scripts.
![]()
Course Objectives
Upon successful completion of this course, students will be able to:
- Read and understand Bash shell scripts
- Debug Bash shell scripts
- Customize and extend their user environment with Bash shell scripts
- Create interactive menus with Bash shell scripts
- Use all key language features of the Bash shell: variables, arrays, branches, loops and functions
- Write Bash shell scripts that perform complex file handling, string manipulations and mathematics
![]()
Course Benefits
Bash is the default shell for Linux. Students will increase their productivity by taking full advantage of the Bash shell.
![]()
Who Should Attend
This course is valuable for system administrators, developers and other computer professionals involved with Linux.
![]()
Prerequisite
To ensure your success, we recommend you first take either our Introduction To UNIX course or our Introduction To Linux course, or have the equivalent knowledge. Familiarity with Web browsers, the
vieditor, and Linux command line interface is assumed.![]()
Method Of Instruction
Lecture, demonstrations, questions and answers, and numerous hands-on exercises.
![]()
Hands-on Exercises
Throughout this course, students perform a series of extensive hands-on exercises including:
- Creating loops and making decisions using
whileandforloops- Writing scripts to perform matematical calculations
- Using
evalfor dynamic commands- Handling errors with default values
- Breaking a large program into reusable modules using functions
- Manipulating multiple files
- Handling unexpected events with
trap- Processing command line options
- Building an interactive menu interface using
caseconstructs andread- Building a colorful and sophisticated menu interface using
dialog![]()
Course Outline
Chapter 1: Linux Processes and ShellsChapter 2: Variables
- What is a Process?
- What is a Shell?
- Process Structure
- The
psUtility- Background Commands (&)
- Killing Background Processes
- Redirecting the Standard Error
- Specifying the Script's Interpreter
- Environment Variables
- Sub-shells
Chapter 3: The Login Process
- Shell Variables
- The
readCommand- The
exportCommand- The Shell Environment
- Parameter Expansion
- Command Substitution
Chapter 4: Conditional Statements
- The Login Process
- The System Profile Script
- Customizing your environment with
.bash_profileChapter 5: Loops
- The Exit Status of Commands
- Command Line Examples
- The
testCommand- The
if-then-elseConstruct- The
elifConstruct- The
caseConstructChapter 6: Special Variables
- For Loop
- While Loop
- break and continue
- Reading Lines From Files
- Using Arrays with Loops
Chapter 7: Quoting Mechanisms
- $$ - PID of Shell
- Command-Line Arguments
- $# - Number of Arguments
- $* - All Arguments
- The
shiftCommand- The
setCommand- Getting Options
Chapter 8: Functions
- Single vs. Double Quotes
- Literals
- Regular Expressions
- Ignoring Leading Tabs
Chapter 9: Advanced Programming
- Shell Functions
- Passing Arguments to Functions
- Setting and unsetting parameters
- Defining global and local variables
- Specifying default values and error conditions
- Returning Values from Functions
- Function Declarations
Chapter 10: Debugging Techniques
- Shell Arithmetic
- The
selectStatement- Terminal Independence in Scripts
- The
evalCommand- Using
dialog
- Using
echo- Using Standard Error
- Script Tracing
- Options for Debugging
- Conditional Debugging
![]()