Korn Shell Course Content
Introduction and Overview
- Role of shell scripting
- Benefits of KornShell and Bash vs. other shells
- Differences and similarities between bash, ksh88 and ksh93
- Integrating scripts with external tools: grep, sed, awk and others
- Customising the login environment
Bash and KornShell Scripting Fundamentals
Shell script elements
- Commands and comments
- Defining exit values
Conditional program execution
- Applying if and case statements
- Simplifying if logic with elif
Program loops and iteration
- Conditional looping with while and until
- Listing for loops
Testing files and directories
- Analysing attributes
- Checking file size and contents
Strings and patterns using (())
- Comparing strings
- Verifying the existence of a string
- Pattern matching and special characters
Debugging
- Redirecting standard error
- set commands for debugging
Storing and Accessing Data
Positional parameters
- Passing and accessing parameters
- Setting and unsetting parameters
- Manipulating parameters as groups
Title Comes HereaShell variables
- Defining environment and local variables
- Specifying default values and error conditions
Arrays
- Creating and indexing arrays
- Processing array contents with special variables
Manipulating strings
- Extracting substrings
- Determining string length
- Find and replace
Mathematics
- Arithmetic for and while loops
- Writing mathematical expressions: (( )), $(( )) and let
Modular Programming with Functions
Function basics
- Functions vs. scripts
- Parameters and variables
Creating a function library
- Finding your library with PATH
- Dot . and source commands
Interacting with the Outside World
Manipulating files and redirecting data
- Scripting file and directory management
- Deciphering redirection order
- Unravelling the secrets of exec: opening and closing multiple files
Interacting with running processes
- Handling errors
- Defining post-termination actions such as notification, cleanup
- Handling and sending signals: trap and kill
Accessing network servers
- Connecting to a network server
- Exchanging data with a network server
Creating Production Quality Scripts
Ensuring environmental control
- Checking and modifying environment variables
- Using getopts to process command line options
Handling user interactions
- Setting up error processing
- Employing select to create a menu interface
- Processing keyboard input