Korn Shell Programming

Duration: 3 days| Price: £895 + VAT | Class Dates:

Students Will Learn:
  • Input/Output Techniques
  • Looping and Conditional Branching
  • Functions, Math, and Arrays
  • String Manipulation
  • Command Line Arguments
  • File Handling and Manipulation

Description: This hands on Korn Shell scripting course provides a comprehensive introduction to writing Korn shell scripts. Besides covering fundamental syntax for program flow control, variable assignment and substitution, I/O control, and mathematical expressions, it emphasizes the powerful features that are unique to this shell, including built-in string operators, variable typesetting/conversion, functions, and coprocess communication and control. The creative use of standard UNIX utilities within scripts to solve problems is stressed throughout. The course is designed for the administrators and programmers who are developing, testing, or integrating software on UNIX, as well as for advanced UNIX users.

Prerequisites: Familiarity with UNIX file system and commands

Korn Shell Programming Course Overview:

Introduction
  • Shells: Bourne, Korn, C, bash
  • Korn Shell Environment
  • Startup Scripts (.profile, .kshrc)
  • Using ENV for automatic environment tailoring
  Korn Shell Command Syntax
  • Commands
  • Options
  • Manipulating Input and Output
    • Redirection
    • Pipes
  • Aliases (alias, unalias)
  • How the Shell Finds Commands
  • Command History and Editing
Variables
  • Assigning Values to Variables
  • set and Special Variables
  • unset
  • Built-in Variables Known to Login Shell
  • The Environment- Exporting Variables
  The Korn Shell as a Programming Language
  • Data Types (typeset)
    • Formatting
    • Base Conversion
    • Read Only and Other Special Attributes
  • Input/Output
  • Conditional Logic and Loops
  • Functions
  • Tests
Input/Output
  • Basic I/O Features
  • String and Field Processing
  • Streams and pipes (exec)
  • Terminal Information (COLUMNS, LINES, TERM)
  • stty
  Shell Scripts
  • Creating Scripts
  • Executing Scripts
  • Passing Arguments to Scripts
  • Built-in Variables Known to Scripts
  • Setting Variables with read
    • Printing with print
  • Special Characters
  • Exiting with exit
  • Debugging
String Manipulation
  • String Comparison
  • String Relations
  • Concatenation
  • Substring Manipulations
  • Wildcards and Pattern Matching
  Conditional Branching
  • If/Then
  • else/elif
  • Statement blocks
  • case Statement
  • Loops (for, while, until)
  • Simple Menus (select)
Math Operators and Functions
  • Dealing with Floating Point Numbers
  Arrays
  • Declaring Arrays
  • Setting and Retrieving Values
Command Line Arguments
  • Positional Parameters
  • Manipulating Positional Parameters (set, sort, shift)
  • Analyzing Switches with getopts
  • Options Reserved Variables (OPTARG, OPTIND, IFS)
  Manipulating Files within Scripts
  • File Operations
  • Testing Files and Directories
  • Changing Protections
Overview of File Manipulation Utilities
  • Input/Output Redirection
  • Editing a File from a Script
  • Scripting with ed or vi
  • UNIX Utilities to Manipulate Files
  • Regular Expressions
  • grep and egrep
  • The Stream Editor sed
  • sort
  • awk
  • Other Text File Utilities 
  Functions
  • Advantages of Functions
  • Writing Functions
  • Calling Functions
  • Functions Arguments
  • Returning Values
  • Local and Global Variables
  • Predefined Functions
  • Exporting Functions
  • Autoloading Functions
  • Returning a Value from a Function
  • Scope of Functions
  • Examples of Useful Functions
Session Control
  • Keyboard Suspend Function
  • Foreground and Background Jobs (bg, fg, %, jobs, wait, nohup, nice)
  • Signals (kill, trap)
  • Coprocesses and Pipes
  • Error Processing (ERRNO, $?)
  • Reserved Variables
  Example Uses of Scripts
  • Prototyping
  • Daily Backup
  • File Selection
  • Installation Scripts
  • Add a User
  • Change all File Extensions
  • Prompt for Input
  • Accounting
Combining Shell Scripts and Compiled Languages
  • Advantages and Disadvantages of the Korn Shell
  • Function Libraries
  Scheduling Execution
  • sleep
  • date
  • cron and crontab
Using UNIX Utilities to Talk to Other Users
  • who, mail, reply, talk, lpr
  UNIX Utilities to Report System Status
  • df, ps, mt, du

Student Testimonials

"One of the best training classes I have ever had. I will definitely recommend HOTT to my friends for their training needs."
– J.W., Independent Contractor


"Great instructor; very responsive to every question, would stay with us after hours."
– E.G., Statesman.com


"I learned a great deal from this class. The knowledge I gained will help me greatly at work."
– K.S., Emerson Corp.


Hands On Technology Transfer, Inc.
The Old Post House
91 Heath Road
Weybridge Surrey
KT13 8TS
Phone: 0870 063 2964

Copyright© Hands On Technology Transfer, Inc.