1.H 1 ksh93 2KSH-93 is the most recent version of the KornShell Language 3described in 4"The KornShell Command and Programming Language," 5by Morris Bolsky and David Korn of AT&T Bell Laboratories, ISBN 0-13-182700-6. 6The KornShell is a shell programming language, 7which is upward compatible with "sh" (the Bourne Shell), 8and is intended to conform to the IEEE P1003.2/ISO 9945.2 Shell and 9Utilities standard. 10KSH-93 provides an enhanced programming environment in 11addition to the major command-entry features of the BSD 12shell "csh". With KSH-93, medium-sized programming tasks can be 13performed at shell-level without a significant loss in performance. 14In addition, "sh" scripts can be run on KSH-93 without modification. 15.P 16The code should conform to the IEEE POSIX 1003.1 standard and to the 17proposed ANSI-C standard so that it should be portable to all 18such systems. Like the previous version, KSH-88, 19it is designed to accept eight bit character sets 20transparently, thereby making it internationally compatible. 21It can support multi-byte characters sets with some characteristics 22of the character set given at run time. 23.P 24KSH-93 provides the following features, many of which were also inherent 25in KSH-88: 26.BL 27.LI 28Enhanced Command Re-entry Capability: The KSH-93 history 29function records commands entered at any shell level and stores 30them, up to a user-specified limit, even after you log off. 31This allows you to re-enter long commands with a few keystrokes 32- even those commands you entered yesterday. 33The history file allows for eight bit characters in 34commands and supports essentially unlimited size histories. 35.LI 36In-line Editing: In "sh", the only way to fix mistyped 37commands is to backspace or retype the line. KSH-93 allows you 38to edit a command line using a choice of EMACS-TC or "vi" 39functions. 40You can use the in-line editors to complete filenames as 41you type them. 42You may also use this editing feature when entering 43command lines from your history file. 44A user can capture keystrokes and rebind keys to customize the 45editing interface. 46.LI 47Extended I/O Capabilities: KSH-93 provides several I/O 48capabilities not available in "sh", including the ability to: 49.BL 50.LI 51specify a file descriptor for input and output 52.LI 53start up and run co-processes 54.LI 55produce a prompt at the terminal before a read 56.LI 57easily format and interpret responses to a menu 58.LI 59echo lines exactly as output without escape processing 60.LI 61format output using printf formats. 62.LI 63read and echo lines ending in "\e". 64.LE 65.LI 66Improved performance: KSH-93 executes many scripts faster 67than the System V Bourne shell. A major reason for this is 68that many of the standard utilities are built-in. 69To reduce the time to initiate a command, KSH-93 allows 70commands to be added as built-ins at run time 71on systems that support dynamic loading such as System V Release 4. 72.LI 73Arithmetic: KSH-93 allows you to do integer arithmetic in any 74base from two to sixty-four. You can also do double 75precision floating point arithmetic. 76Almost the complete set of C language operators are available 77with the same syntax and precedence. 78Arithmetic expressions can be used to as an argument expansion 79or as a separate command. 80In addition there is an arithmetic for command that works 81like the for statement in C. 82.LI 83Arrays: KSH-93 supports both indexed and associative arrays. 84The subscript for an indexed array is an arithmetic expression, 85whereas, the subscript for an associative array is a string. 86.LI 87Shell Functions and Aliases: Two mechanisms - functions and 88aliases - can be used to assign a user-selected identifier to 89an existing command or shell script. 90Functions allow local variables and provide scoping 91for exception handling. 92Functions can be searched for and loaded on first reference the 93way scripts are. 94.LI 95Substring Capabilities: KSH-93 allows you to create a 96substring of any given string either by specifying the starting 97offset and length, or by stripping off leading 98or trailing substrings during parameter substitution. 99You can also specify attributes, such as upper and lower case, 100field width, and justification to shell variables. 101.LI 102More pattern matching capabilities: KSH-93 allows you to specify 103extended regular expressions for file and string matches. 104.LI 105KSH-93 uses a hierarchal name space for variables. 106Compound variables can be defined and variables can 107be passed by reference. In addition, each variable 108can have one or more disciplines associated with 109it to intercept assignments and references. 110.LI 111Improved debugging: KSH-93 can generate line numbers on execution 112traces. Also, I/O redirections are now traced. 113There is a DEBUG trap that gets evaluated before each command 114so that errors can be localized. 115.LI 116Job Control: On systems that support job control, including 117System V Release 4, KSH-93 118provides a job-control mechanism almost identical to that of 119the BSD "csh", version 4.1. 120This feature allows you 121to stop and restart programs, and to move programs between the 122foreground and the background. 123.LI 124Added security: 125KSH-93 can execute scripts which do not have read permission 126and scripts which have the setuid and/or setgid set when 127invoked by name, rather than as an argument to the shell. 128It is possible to log or control the execution of setuid and/or 129setgid scripts. 130The noclobber option prevents you from accidentally erasing 131a file by redirecting to an existing file. 132.LI 133KSH-93 can be extended by adding built-in commands at run time. 134In addition, KSH-93 can be used as a library that can 135be embedded into an application to allow scripting. 136.LE 137Documentation for KSH-93 consists of an "Introduction to KSH-93", 138"Compatibility with the Bourne Shell" and a manual page and a 139README file. In addition, the "New KornShell Command and Programming 140Language," book is available from Prentice Hall. 141 142