Choose your language:

Hong Kong
New Zealand
United Kingdom
United States

Advanced Korn Shell Programming

Course Code



4 Days

Extensive use of UNIX commands and shell scripting. The participant should be thoroughly familiar with directories, file permissions, and using the system editor (such as vi). There is no review of basic features of the shell as covered in the Korn Shell Programming introductory course, so participants must be moderately well-versed in shell scripting.
This course is a follow-on to the Korn Shell Programming introductory course. 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:

  • Opening files for read, write, and read/write from within the shell
  • Using all 20 forms of parameter substitution for precise control of expressions
  • Using associative arrays to increase performance in lookup-intensive scripts
  • How to produce formatted output layouts
  • Define and use shell functions to better modularize shell scripts
  • Create coprocesses as a rudimentary form of parallel processing
Advanced I/O Redirection
Using file descriptors other than 0, 1, and 2
Closing a file descriptor when I/O is complete
Capturing stderr from commands in a pipe
Using I/O redirection with remote commands (such as with ssh)

Command and variable substitution
Old-style (obsolete) syntax
New-style syntax
Single and double quotes: When to use each type

Data types for variables using typeset
Performance aspects
Functional aspects
When to use printf for formatting
Suggestions for integrating typed variables with read

What is an array?
Syntax for creating and accessing arrays
When should arrays be used?
Limits in various implementations
Associative arrays (string instead of numeric subscripts)
Shell functions: Basics
Definition: What is a shell function?
Defining shell functions
Using functions in scripts
Building reusable libraries

Shell functions: Advanced
What are autoload functions?
How to use PATH, FPATH, and typeset -f
When is FPATH is searched?
Recent changes in the shell regarding autoloaded functions

Using eval
Examples of the need for eval
Issues related to quoting
Suggestions for how to avoid complicated cases

Program flow control
Review of if, while, for, and case
The until loop
Details of using select for interactive menus

Compound variables
What is a compound variable?
The shell's built-in compound variables
User-defined compound variables: why?

What is a coprocess?
When are coprocesses useful?

Debugging programs
Using the shell's -e, -x, and -v options
Using the ERR and DEBUG signals with the trap command
Can you use kshdb?

Performance evaluation and tuning
Why performance matters in shell scripts
Development of a general timing harness
Send Us a Message
Choose one