PROMO.mm revision 7c2fbfb345896881c631598ee3852ce9ce33fb07
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.H 1 ksh93
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinKSH-93 is the most recent version of the KornShell Language
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chindescribed in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin"The KornShell Command and Programming Language,"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinby Morris Bolsky and David Korn of AT&T Bell Laboratories, ISBN 0-13-182700-6.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThe KornShell is a shell programming language,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinwhich is upward compatible with "sh" (the Bourne Shell),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinand is intended to conform to the IEEE P1003.2/ISO 9945.2 Shell and
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinUtilities standard.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinKSH-93 provides an enhanced programming environment in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinaddition to the major command-entry features of the BSD
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinshell "csh". With KSH-93, medium-sized programming tasks can be
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinperformed at shell-level without a significant loss in performance.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinIn addition, "sh" scripts can be run on KSH-93 without modification.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.P
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThe code should conform to the IEEE POSIX 1003.1 standard and to the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinproposed ANSI-C standard so that it should be portable to all
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinsuch systems. Like the previous version, KSH-88,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinit is designed to accept eight bit character sets
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintransparently, thereby making it internationally compatible.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinIt can support multi-byte characters sets with some characteristics
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinof the character set given at run time.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.P
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinKSH-93 provides the following features, many of which were also inherent
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinin KSH-88:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.BL
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinEnhanced Command Re-entry Capability: The KSH-93 history
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinfunction records commands entered at any shell level and stores
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinthem, up to a user-specified limit, even after you log off.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThis allows you to re-enter long commands with a few keystrokes
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin- even those commands you entered yesterday.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThe history file allows for eight bit characters in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chincommands and supports essentially unlimited size histories.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinIn-line Editing: In "sh", the only way to fix mistyped
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chincommands is to backspace or retype the line. KSH-93 allows you
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinto edit a command line using a choice of EMACS-TC or "vi"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinfunctions.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinYou can use the in-line editors to complete filenames as
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinyou type them.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinYou may also use this editing feature when entering
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chincommand lines from your history file.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinA user can capture keystrokes and rebind keys to customize the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinediting interface.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinExtended I/O Capabilities: KSH-93 provides several I/O
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chincapabilities not available in "sh", including the ability to:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.BL
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinspecify a file descriptor for input and output
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstart up and run co-processes
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinproduce a prompt at the terminal before a read
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chineasily format and interpret responses to a menu
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinecho lines exactly as output without escape processing
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinformat output using printf formats.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinread and echo lines ending in "\e".
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LE
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinImproved performance: KSH-93 executes many scripts faster
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinthan the System V Bourne shell. A major reason for this is
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinthat many of the standard utilities are built-in.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinTo reduce the time to initiate a command, KSH-93 allows
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chincommands to be added as built-ins at run time
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinon systems that support dynamic loading such as System V Release 4.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinArithmetic: KSH-93 allows you to do integer arithmetic in any
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinbase from two to sixty-four. You can also do double
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinprecision floating point arithmetic.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinAlmost the complete set of C language operators are available
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinwith the same syntax and precedence.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinArithmetic expressions can be used to as an argument expansion
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinor as a separate command.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinIn addition there is an arithmetic for command that works
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinlike the for statement in C.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinArrays: KSH-93 supports both indexed and associative arrays.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThe subscript for an indexed array is an arithmetic expression,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinwhereas, the subscript for an associative array is a string.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinShell Functions and Aliases: Two mechanisms - functions and
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinaliases - can be used to assign a user-selected identifier to
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinan existing command or shell script.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinFunctions allow local variables and provide scoping
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinfor exception handling.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinFunctions can be searched for and loaded on first reference the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinway scripts are.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinSubstring Capabilities: KSH-93 allows you to create a
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinsubstring of any given string either by specifying the starting
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinoffset and length, or by stripping off leading
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinor trailing substrings during parameter substitution.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinYou can also specify attributes, such as upper and lower case,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinfield width, and justification to shell variables.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinMore pattern matching capabilities: KSH-93 allows you to specify
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextended regular expressions for file and string matches.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinKSH-93 uses a hierarchal name space for variables.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinCompound variables can be defined and variables can
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinbe passed by reference. In addition, each variable
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chincan have one or more disciplines associated with
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinit to intercept assignments and references.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinImproved debugging: KSH-93 can generate line numbers on execution
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintraces. Also, I/O redirections are now traced.
7c2fbfb345896881c631598ee3852ce9ce33fb07April ChinThere is a DEBUG trap that gets evaluated before each command
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinso that errors can be localized.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinJob Control: On systems that support job control, including
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinSystem V Release 4, KSH-93
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinprovides a job-control mechanism almost identical to that of
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinthe BSD "csh", version 4.1.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThis feature allows you
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinto stop and restart programs, and to move programs between the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinforeground and the background.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinAdded security:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinKSH-93 can execute scripts which do not have read permission
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinand scripts which have the setuid and/or setgid set when
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chininvoked by name, rather than as an argument to the shell.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinIt is possible to log or control the execution of setuid and/or
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinsetgid scripts.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThe noclobber option prevents you from accidentally erasing
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968china file by redirecting to an existing file.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LI
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinKSH-93 can be extended by adding built-in commands at run time.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinIn addition, KSH-93 can be used as a library that can
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinbe embedded into an application to allow scripting.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LE
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinDocumentation for KSH-93 consists of an "Introduction to KSH-93",
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin"Compatibility with the Bourne Shell" and a manual page and a
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinREADME file. In addition, the "New KornShell Command and Programming
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinLanguage," book is available from Prentice Hall.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin