Mastering UNIX Shell Scripts

4 Day Course
Hands On

This course has been retired. Please see Unix Shell Programming or Unix Advanced Shell Programming for alternative options.


Collapse all

Introduction (1 topic)

  • What is a shell?: Types of shell

Review (5 topics)

  • Redirection and pipes
  • Wildcards
  • Creating shell scripts
  • The .profile file
  • Grouping commands and background execution

Overview (7 topics)

  • Tilde expansion
  • The whence command
  • Quoting
  • Using aliases
  • The ENV file
  • Here documents
  • Job control

Variables (4 topics)

  • Setting and getting variables
  • Using ${} and $()
  • Exported, read only and predefined variables
  • Length of variables

Parameters (4 topics)

  • Positional parameters
  • Counting parameters
  • Using shift
  • Parameters and set

Making Decisions (8 topics)

  • Exit status
  • If-then
  • If-then-else
  • If-then-elif-then-else
  • Tests
  • The case statement
  • Logical tests
  • More pattern matching

Loops (6 topics)

  • The while and until loops
  • The for loop
  • Break and continue
  • The select command
  • I/O redirection and loops
  • The getopts command

Arithmetic in the Shell (5 topics)

  • Declaring integer variables
  • Operators
  • The let keyword
  • Making arithmetic tests
  • Using other bases

Functions (5 topics)

  • Writing functions
  • Return values from functions
  • Autoload
  • Local versus global variables
  • Listing and removing functions

Debugging in the Shell (4 topics)

  • Setting the xtrace option
  • The trace prompt
  • Tracing functions
  • Traps

Handling Arrays (3 topics)

  • Accessing elements
  • Setting elements
  • Counting the elements in an array

Professional Scripts (2 topics)

  • Organising project files
  • Enhancing script behaviour with getopts

More Complicated I/O (3 topics)

  • Putting files onto file descriptors
  • Read and print revisited
  • Co-processes

Introduction to sed and awk (9 topics)

  • Simple instructions
  • Script files
  • Regular expressions
  • Addressing in sed
  • Grouping commands in sed
  • The main awk loop
  • Referencing fields
  • Predefined awk values
  • Variables, operators


Programmers and analysts operating in UNIX environments, as well as UNIX system and network managers. Delegates must have a good working knowledge of the Unix system. This can be gained by attending the UNIX Fundamentals course. Some practical understanding of programming concepts is also required. Typically, delegate skills will include a working knowledge of UNIX commands and utilities, proficiency in using a generic UNIX file editor, preferably vi, and familiarity with programming concepts, such as batch processing, loops, decision-making constructs.

Additional Learning

The courses below may help you meet the knowledge level required to take this course.

  • Multi-vendor Unix Fundamentals

    The Unix Fundamentals training course teaches students how to use the basic facilities of a Unix system and is applicable to all UNIX variants

    4 Day Course Hands On Training Course Code MVUXFUND-1
    Classroom Virtual Classroom Private Group - Virtual Self-Paced Online

Course PDF