EEC Logo


Korn Shell Programming

Duration: 3 days

Audience

Individuals requiring a mastery of the command line interface to the UNIX operating system. This includes system administrators, programmers, and power users.

Course Contents

  1. Review of Useful Shell Commands
    1. head and tail
    2. cut and paste
    3. find
    4. ps
    5. others
  2. Shell Basics
    1. Using Redirection, Pipes, Command and Variable Substitution
    2. Creating and Using Shell Scripts
    3. Single and Double Quotes
    4. Command Line Parsing
  3. Using ksh
    1. Command Line Editing
    2. Using the History, Alias, and Function Facilities
    3. Korn Shell Job Control
    4. The Shell Environment
  4. Shell Scripting, Part 1: Basics
    1. Why Shell Programming?
    2. Steps to Creating a Script
    3. Menu Building Example Using select
    4. Commenting Your Shell Scripts
    5. Working with Variables
    6. Proper Use of Error Messages
    7. Performing Arithmetic in the Shell
    8. Using expr for String Matching (deprecated)
    9. Interactive Shell Scripts
  5. Shell Scripting, Part 2: Flow Control
    1. Control Flow: if-then-else
    2. Test Operations (using test, [ ], and [[ ]])
    3. Control Flow: for Loops
    4. Control Flow: while Loops
    5. Changing the Script Parameters
    6. Changing Loop Flow (break and continue)
    7. Multi-choice case Statements
    8. Exiting a Shell Script
    9. Using select to Build a Menu
  6. Shell Scripting, Part 3: User Interaction
    1. Using getopts For Handling Options
    2. Temporary Files
    3. The trap Command
    4. Debugging Options in the Korn Shell
  7. Shell Scripting, Part 4: Efficiency
    1. Subshells
    2. Conditional Execution
    3. Floating Point Arithmetic
    4. Using Coprocesses
    5. HERE Documents
    6. Shell Functions

Course Objectives

Upon completion of this course, the student will be able to write Korn Shell scripts using the following features and more:

Instructional Technique

Students are invited to bring their current ideas and questions to the classroom for discussion. Case studies, lecture, group problem solving, and online laboratories will be used. Students will be encouraged to enhance their skills utilizing the techniques presented through classroom problem solving and controlled online workshops.

Prerequisites

Familiarity with Unix commands, directory structure, and the text editor is required; this course includes a short review of some basics, but proficiency with the system editor is expected.

Programming skills are not required, but are helpful.