-

Korn Shell

-

Contained here are a wide variety of example Korn Shell scripts. These scripts include applications, programs, utilities, functions, and code snippets. You are free to download and evaluate these scripts. If you choose to continue to use these scripts in a commercial environment, you will be required to obtain a license for this purpose. Please contact Mt Xia for licensing details.

Special Interest Topics:


How to Create Shell Script Function Libraries:
Procedures and VIDEO that provide step-by-step instructions for creating shell script function libraries.
How to Create Shell Scripts that are Executable in Multiple Shells:
VIDEO that provides instructions for creating shell scripts that are compatible with multiple shell interpreters such as KornShell, Bash, and Zshell.
Content Management:
Documentation and web site content management functions.
kshAuth:
Authentication and authorization system for Apache 2.2+ web server. Provides the ability to enable password protection on a directory-by-directory basis. Also allows delegation of administration responsibilities to multiple users.
Fortune:
Unix "fortune" data for Korn Shell 93.
Functions:
Various Korn Shell functions.
K93 Unix:
Korn Shell 93 implementation of standard Unix commands.
Time and Date:
Time and Date manipulation functions.
Monitoring:
System and Process Monitoring Functions.
Editors:
Full screen text editors written in Korn Shell script language.
Wiki:
Scripts for automating interactions with a Wiki Server.
Checklist:
Verification Checklist for System Builds.
Korn Shell 93 Binary: for AIX with SHOPT_AUDIT enabled
This is the Korn Shell 93 binary compiled for IBM AIX 5.3 with the auditing feature "SHOPT_AUDIT" enabled.
Korn Shell 93 Binary: for Linux with SHOPT_AUDIT enabled
This is the Korn Shell 93 binary compiled for Linux with the auditing feature "SHOPT_AUDIT" enabled.
Korn Shell 93 Binary: for 32 bit PPC Linux with SHOPT_AUDIT enabled
This is the Korn Shell 93 binary compiled for Linux on 32 bit PPC with the auditing feature "SHOPT_AUDIT" enabled.
ksh93 Quick Reference Guide: Testing and Substitutions:
This is a 2 page, tri-fold document containing Korn Shell 93 Quick Reference guide for variable substitutions, file attribute testing, string and numeric comparisions, and korn shell patterns.
ksh93 Quick Reference Guide: Built-in Commands:
This is a 2 page, tri-fold document containing Korn Shell 93 Quick Reference guide for built-in commands to the shell.
ksh93 Quick Reference Guide: set and unset Commands:
This is a 2 page, tri-fold document containing Korn Shell 93 Quick Reference guide for the "set" and "unset" commands.
ksh93 Quick Reference Guide: typeset Command:
This is a 2 page, tri-fold document containing Korn Shell 93 Quick Reference guide for the "typeset" command.

wikiAutoLoad:
Shell script that provides automated mechanism for uploading content, pages, categories, templates, etc. to a Wiki Server.
(non-html version)  (VIDEO)

visualSelect:
Shell Script Menuing and Data interface utilizing single key press mechanisms
(non-html version)  (VIDEO)

autocontent:
Automatically extracts specially commented lines from shell scripts and generates HTML documentation.
(non-html version)  (VIDEO)

shellscript_template_k93:
This is a korn shell scripting template for creating new korn shell scripts.
(ksh93 version)  (multi-shell version)  (VIDEO)  (BOOK)

mkascii:
Generate an ASCII Table into an array (indexed by ASCII Character)

mkhacmp:
This script generates the HACMP commands necessary to build/rebuild a 2 node - 1 or 2 way cascading cluster, each node with one or more resource groups, each resource group with one or more application servers.

mkord:
Generate an ASCII Table into an array (indexed by ASCII Decimal Value)

mkrandstr:
Random String Generator. Korn shell script that generates a random string of characters of a configurable length. (Command line or Function)

mkrandpwd:
Random Password Generator. Korn shell script that generates a configurable random password string.

mkversion:
Source code versioning system.
(non-html version)  (VIDEO)

cal2html_k93:
Translate the calendar output from the Unix "cal" command into HTML.

menugen9_k93:
HTML Look-and-Feel generator. Uses SSI and also produces navigational menus based on page relationships.

menugen10_k93:
HTML Look-and-Feel generator. Uses SSI and also produces navigational menus based on page relationships.
(non-html version)

mkuue:
This utility creates a self extracting archive for a specified file. The self extracting archive contains a shell script that knows how to test and reconfigure various attributes of the file, and the archive also contains a "uuencoded" copy of the file itself.

txt2html_k93:
txt2html is a plain text to HTML converter written as a Korn Shell 93 script function. It succesfully converts subtle text markup to lists, bold, italics, tables and headings to their corresponding HTML markup without having to write unreadable source text files.
(Source Code) (README Text File) (README HTML File) (VIDEO: How To Use)

discipline:
This script provides several example "discipline" functions. A discipline function is a function that is associated with a specific variable. This allows you to define and call a function every time that variable is referenced, set, or unset. These functions take the form of varname.function, where varname is the name of the variable and function is the discipline function. The predefined discipline functions are get, set, and unset.
(non-html version)

mkewuid_k93:
Generate an enterprise wide unique identifier value for any given input string of characters. For example, this script can be used to generate an Enterprise Wide Unique UID number for any given user name. The output value may be calculated in a user selectable format and number of digits.
(non-html version)

threeDigitOctet_k93:
This script accepts one or more IP address arguments on the command line and converts each octet into 3 digits, zero filling where necessary. The result is an IP address where each octet is a 3 digit number.
(non-html version)

integerIPAddress_k93:
This script accepts one or more dotted decimal IP addresses on the command line and converts each into a base10 integer number.
(non-html version)

sortarray_k93:
Sorts a Korn Shell indexed array of values by a variety of mechanisms:
  • Lexical - Alphabetic sort order
  • Numeric - Sorts by decimal digits or floating point numbers
  • Reverse - Changes sort order to decending
  • (non-html version)

    randomizearray_k93:
    This script will accept an indexed array of values and randomize the index positions of the values in the array. It will also read a file into the specified index array, one line per array element, then randomize those values and store them in a second user specified indexed array. (non-html version)

    mkArrayFromFile_k93:
    Reads a file and constructs the shell commands needed to define an INDEX or ASSOCIATIVE array from the contents of the file. The output of this function are the commands needed to define an array, NOT an array. These commands must be executed separately from this function to define the array contents. See the example usage below. (non-html version)

    mkAtJob_k93:
    Schedule a command to run sometime in the future via an "at" job, by adding a specified number of days, hours, and/or minutes to the current date/time. (non-html version)

    dodwipe_k93:
    The dodwipe_k93 will perform a DoD style disk wipe of a file, logical volume, or disk partition. It performs 3 passes, first pass fills the space with zero's using an octal 0 character, second pass fills the space with one's using an octal 377 character, and the third pass fills the space with random bits. (non-html version)

    getfilestruct_k93:
    This script builds arrays of values representing directory and file names, with owner, group, and permissions. It will also generate the commands necessary to recreate the directory structure, and to restore the owner, group, and permissions to all directories and files under a top level directory. (ksh93 version) (bash version) (multi-shell version)
    VIDEO: Multi-Shell Instructions using "getfilestruct" as example