Exercises, examples and other material relating to training module A172. This module is presented on Private Courses
and Specially Run Courses
Related technical and longer articlesKorn Shell - BasicsKorn Shell - History, storing to file, commandsKorn Shell Scripting - an introduction
|Articles and tips on this subject||updated|
|1660||Korn shell - some nuggets|
I've presented some Korn Shell Training over the last couple of days ,,, and I cut and pasted a few snippets which I thought might be of interest.
• Korn Shell - looping through a series of outputs from a command
$ for file in `ls`; do
> echo $file
|1659||String, Integer, Array, Associative Array - ksh variables|
• In the Korn Shell, variables default to be being strings ...
$ r 26
$ r 30
while (( $kay>3 )); do
• ... but you can declare them as integers.
$ integer kay
$ echo $kay
$ (( g = 8+8 ))
$ echo $g
$ echo ...
|1658||Some useful variables and settings in the Korn Shell|
Here are some hidden "gems" ...
• -C sets "noclobber" mode in which redirects do not overwrite files
$ set -C
$ ls > fred
$ ls > fred
ksh: cannot create fred: File exists
$ set +C
$ ls > fred
• CDPATH lets you change the target for your cd command to a list of directories whihc are ...
|1367||korn tips - some useful korn shell techniques|
1. If you set PS1 to a string that contains a "!" character, then you'll get the current history number reported as part of the prompt. If you want to rerun the same command number 246 later, all you then need to do is type
2. If you're debugging a Korn shell script and want to work out what ...
|1365||Korn Shell scripts on the web|
I know that the Korn shell isn't exactly the most common language for web scripting ;-) .... but if you've got a load of Korn shell scripts and a heap of Korn shell experts ... why not?
"How would you do it" I was asked yesterday and I put together a tiny demo to show some of the first principles. ...
|1364||Korn shell course - resources|
I'm running a Korn shell course today and happened to take a "snap" of the resources set out ready for the course start.
* Sign in sheet
* One laptop computer, with appropriate software, per delegate
* One set of course notes, approx 80 pages per day, per delegate
* One regular expression mousemat ...
|1361||Korn shell course|
It's been quite a while since I presented a course that majored on the Korn Shell - I know the subject right enough (having written a complete 2 day course that got rave if niche reviews during a previous lifetime), and I jumped at a chance to brush up on my old skills to day, to recall the differences ...
Examples from our training material
Some modules are available for download
as a sample of our material or under an Open Training Notes License
for free download from [here]
Topics covered in this module
Introduction to Shells and the Korn Shell.
Korn Shell Basics.
Metacharacters, quoting, pipes and redirection.
Continuation and line splitting.
History. Storing a script in a file.
Builtins, special commands and external commands.
if, elif and fi.
while, do, done.
Until and for.
case and esac.
break, continue and return.
Arrays in Ksh. Integer Arithmetic.
Logical tests - commands and others
Testing files, numbers and strings.
Handling command line parameters.
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule
Well House Consultants specialise in training courses in
Linux and LAMP
. We run
throughout the UK (and beyond for longer courses), and
at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if you live in a different
country or continent to us
We have a technical library of over 700 books on the subjects on which we teach.
These books are available for reference at our training centre.