Korn Shell Programming
"Ireland's Centre for Linux & Unix Excellence"
This 4 day course covers Korn Shell scripting from the basics of the shell command line through to powerful and complex shell scripts. One of the aims of the course is to provide the student with a good exposure to the world of Korn shell scripts and the UNIX scripting scene in general. As part of achieving this aim, the course provides a broad look at how shell scripting has evolved from early Bourne shell scripting techniques, through to the Korn shell. This prepares the student for maintaining existing archives of shell scripts with some of their more obscure structures and techniques as well as providing them with a powerful toolkit for implementing new projects.
This course is particularly focused on practice. For experienced and new programmers alike the easiest method to learn any new programming environment is to get stuck in. 70% of the time spent on this course is spent writing and debugging scripts with input and advice from the instructor. The exercises are specifically designed to keep more experienced programmers busy and challenged without being out of reach of the less experienced. A good knowledge of the UNIX basics, however, is important as a pre-requisite.
- Overview: Overview of course topics. A quick history of UNIX shells and their major differences. Versions of the Korn Shell. Major differences between the available versions of the Korn Shell.
- Introduction: What is a shell? What is a shell script? Introduction to some very simple scripts.
- Shell Variables: User defined and built in variables.
- Process Exit Status: Demonstrated with '$?'. Its use within 'if' and 'while' constructs.
- Testing: Testing numbers, strings and files. Introduces the test command and its variants - '[' and '[['.
- The 'if' statement: Handling the flow of control in your scripts.
- 'if … elif … else'
- Simplifying 'if … elif': The 'case' statement and its pattern matching features
- 'while' loops: Introduces looping to our scripts.
- 'for' loops: Iterating over a list of items.
- Communicating with the user: read and print.
- 'break' and 'continue': The 'break' and 'continue' commands.
- Handling parameters: 'for' loops, 'shift' and 'while'.
- Functions: Modularising your code.
- Local Shell Variables: and other 'typeset' operations.
- 'exit' command: Setting an exit status.
- Arithmetic: Performing mathematical calculations with Korn shell.
- Korn Shell's newer Arithmetic and comparison: The Korn Shell's newer sytax and structures for handling arithmetic and comparisons more effectively.
- 'here' documents, 2 way pipes and further I/O redirection: Communicating with and automating background processes. Opening extra i/o streams.
- trap and signals: How to react to the standard UNIX signals.
- The EXIT signal: The Korn Shell's built in EXIT 'signal'.
- Background processes and the 'wait' command: Synchronous processing.
- Other automation issues: Some remaining issues encountered when automating tasks.
- Debugging: The Korn Shell's builtin debugging settings and signals.
- Introduction to 'sed': Basic use of the stream editor. Mainly focuses on command line 'sed', particularly focussing on the substitute command.
- Introduction to 'awk': Indispensable for formatting data. Covers fully fledged 'awk' scripts. Looks at the important differences between the various implementations of awk (awk, nawk and gawk).
- Linux or Unix Fundamentals Course (any version), or equivalent knowledge.
Option of other related or follow-on courses:
- Solaris™ Practical Administration
- SolarisTM Advanced System Administration
- Solaris™ Advanced System and Network Administration FasTrack
- HP-UX Practical Administration
- Enterprise Linux Administration