Find Courses Here
Korn Shell Programming Print E-mail
Course Length - 3 Days
 
Course Description

In this three-day hands-on course students learn how to read, write, and debug complex Korn shell scripts.

 
  
You Will Learn How To

Upon successful completion of this course, students will be able to: 

  • Read and understand Korn shell scripts
  • Debug Korn shell scripts
  • Customize and extend their user environment with Korn shell scripts
  • Create interactive menus with Korn shell scripts
  • Use all key language features of the Korn shell: variables, arrays, branches, loops and functions
  • Write Korn shell scripts that perform complex file handling, string manipulations and mathematics
 
  
Course Benefits

Korn is a very popular UNIX shell. Students will increase their productivity by taking full advantage of the Korn shell.

 
  
Course Prerequisites

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 vi editor, and UNIX command line interface is assumed.

 
  

Who Should Attend?

This course is valuable for system administrators, developers and other computer professionals involved with UNIX.

 
  
Hands-On Exercises:

Throughout this course, students perform a series of extensive hands-on exercises, including: 

  • Creating loops and making decisions using while and for loops
  • Writing scripts to perform matematical calculations
  • Using eval for 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 case constructs and read
  
Course Outline:  

UNIX Processes and Shells

 
  • What is a Process?
  • What is a Shell?
  • Process Structure
  • The ps Utility
  • Background Commands (&)
  • Killing Background Processes
  • Redirecting the Standard Error
  • Specifying the Script's Interpreter
  • Environment Variables
  • Sub-shells
 
Variables 
  • Shell Variables
  • The read Command
  • The export Command
  • The Shell Environment
  • Parameter Expansion
  • Command Substitution
 
The Login Process 
  • The Login Process
  • The System Profile Script
  • Customizing your environment with .profile
 
Conditional Statements 
  • The Exit Status of Commands
  • Command Line Examples
  • The test Command
  • The if-then-else Construct
  • The elif Construct
  • The case Construct
 
Loops 
  • For Loop
  • While Loop
  • break and continue
  • Reading Lines From Files
  • Using Arrays with Loops
 
Special Variables 
  • $$ - PID of Shell
  • Command-Line Arguments
  • $# - Number of Arguments
  • $* - All Arguments
  • The shift Command
  • The set Command
  • Getting Options
 
Quoting Mechanisms 
  • Single vs. Double Quotes
  • Literals
  • Regular Expressions
  • Ignoring Leading Tab
 
Functions 
  • 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
 
Advanced Programming 
  • Shell Arithmetic
  • The select Statement
  • Terminal Independence in Scripts
  • The eval Command
 
Debugging Techniques 
  • Using echo
  • Using Standard Error
  • Script Tracing
  • Options for Debugging
  • Conditional Debugging