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