Course Description
In this two-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. Prior programming experience is highly recommended.![]()
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
- Working with arrays
- 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 colorful and sophisticated menu interfaces using
dialog![]()
Course Outline
Chapter 1: Using Structured CommandsChapter 2: Handling User Input
if,then,elif,fi- The
testcommand- Compount condition testing
- The
casecommand- The
forcommand- The
whilecommand- The
untilcommand- Nesting Loops
- The
breakcommand- The
continuecommand- Processing the output of a loop
- Specifying default values and error conditions
- Shell arithmetic
- The
selectstatement- The
evalcommandChapter 3: Presenting Data
- $$ - PID of the shell
- $# - Number of arguments
- $* - All arguments
- Getting Options
- Reading in command arguments
- The
readcommand- The
IFScommand- The
shiftcommand- The
setcommand- Parameter expansion
Chapter 4: Script Control
- File descriptors
- Redirecting input and output
- Using temporary files
Chapter 5: Functions
- Signals
- Running scripts in the background
- Running scripts without a terminal
- The
atandbatchcommands- The
nicecommand- Having
cronrun scripts- Runnings scripts when booting
Chapter 6: Interactive Graphics
- Calling a function
- 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
- Passing and returning arrays
- Creating and using libraries
- Using functions on the command line
Chapter 7:
- Creating text menus
- Adding color
- The
dialogcommand- Integrating GNOME and KDE into scripts
sedandawkChapter 8: Debugging Techniques
- Multiline commands
- Inserting and appending text
- Pattern replacemnt
- Extracting fields
- String manipulation
- Formatting output
- Using functions
- Using
echoandprintf- Using Standard Error
- Script Tracing
- Options for Debugging
- Conditional Debugging
![]()