Exercises, examples and other material relating to training module A172. This module is presented on
Private Courses and
Specially Run Courses only
Related technical and longer articles
Korn Shell Scripting - an introductionKorn Shell - History, storing to file, commandsKorn Shell - Basics
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
> done
LinuxBasicsAdmin.book.pdf
Sefas.book.pdf
dat_backup
dat_backup2
dat_backup3
filestat
funky
gvar
hello_korn
kornserver.cgi
ksh.book.pdf
ksh.ps
numtee
pippa
script_korn
selk
sharon
stroppy
townline
tracey
$ ... | 2008-05-30 |
1659 | String, Integer, Array, Associative Array - ksh variables • In the Korn Shell, variables default to be being strings ...
$ r 26
kay=7
$ r 30
while (( $kay>3 )); do
echo $kay
kay=$kay-1
done;
7
7-1
7-1-1
7-1-1-1
$
• ... but you can declare them as integers.
$ integer kay
$ kay=7
$ kay=$kay-1
$ echo $kay
$ (( g = 8+8 ))
$ echo $g
16
$ h=8+8
$ echo ... | 2008-05-30 |
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 ... | 2008-05-30 |
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
r 246
2. If you're debugging a Korn shell script and want to work out what ... | 2007-09-25 |
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. ... | 2007-09-25 |
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 ... | 2007-09-24 |
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 ... | 2007-09-22 |
Examples from our training material
Background information
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.
Startup files.
Builtins, special commands and external commands.
Aliases. Functions.
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.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our
Listing and schedule page.
Well House Consultants specialise in training courses in
Linux and LAMP,
Ruby,
Lua,
Python,
Perl,
PHP, and
MySQL. We run
Private Courses throughout the UK (and beyond for longer courses), and
Public Courses 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.