1*35116SmarcThis is a list of changes that have been made since the 02/21/85 version 2*35116Smarcof ksh. A number enhancements have been made. The rest are bug fixes. 3*35116SmarcMany changes of the code have been made to enhance portability with certain 4*35116Smarccompile options driven by the characteristics of the target system. 5*35116Smarc 6*35116Smarc1. Ksh-i now accepts eight bit character sets transparently. Previous 7*35116Smarc versions used the eighth bit internally to keep track of quoting. 8*35116Smarc 9*35116Smarc2. The expansion for "$*" now uses the first character of the IFS parameter 10*35116Smarc as a separator rather than a space. If IFS is unset or null then no 11*35116Smarc separator is used. "$@" now expands correctly to "$1" "$2" ..., 12*35116Smarc when used as a command argument, no matter what value IFS has. 13*35116Smarc "${@}" and "${array[@]}" now correctly expand to no an implicit null 14*35116Smarc when {#@} and ${#array[@]} are zero. 15*35116Smarc 16*35116Smarc3. The protected mode, -p has been added to 'set' and to the shell invocation 17*35116Smarc line. This sets the PATH variable to the default, disables the .profile, 18*35116Smarc and uses the file /etc/suid_profile instead of the ENV file. This mode is 19*35116Smarc set automatically for setuid,setgid scripts. The default path has been 20*35116Smarc changed to /bin:/usr/bin:. A restricted shell now disables setting the 21*35116Smarc ENV parameter. 22*35116Smarc 23*35116Smarc4. The shell can now execute scripts which do not have read permission 24*35116Smarc and scripts which have the setuid and/or setgid set when they are 25*35116Smarc invoked by name rather than as an argument to the shell. For this 26*35116Smarc feature to work, a program supplied with ksh-i named suid_exec must 27*35116Smarc be installed as a suid root program in /etc and ksh-i must be 28*35116Smarc installed in the /bin directory. 29*35116Smarc 30*35116Smarc5. The history file has a slightly changed format. Old style ksh 31*35116Smarc history files are recognized and read correctly. It allows eight 32*35116Smarc bit characters in commands and supports essentially unlimited size 33*35116Smarc histories. 34*35116Smarc 35*35116Smarc6. The HISTSIZE parameter now controls how many commands from the last 36*35116Smarc login session are saved. Previously, the last 4K bytes of the history 37*35116Smarc file was saved across logins but since the history file stores the 38*35116Smarc text of functions, the number of saved commands varied. 39*35116Smarc 40*35116Smarc7. The shell now accepts decimal values as numerical constants when 41*35116Smarc performing arithmetic evaluation and truncated them. Thus let x=2.2 42*35116Smarc yields x=2 rather than producing an error message. 43*35116Smarc 44*35116Smarc8. Options settings, set, are now atomic, i.e., they all take effect or 45*35116Smarc none take effect. Previously, set -emacs caused the shell to abort 46*35116Smarc since -e set the error on exit, and the c option cause the set 47*35116Smarc command to terminate with an error. Now this will just produce 48*35116Smarc an error. 49*35116Smarc 50*35116Smarc9. The commands echo and pwd are built into ksh-i. Previously, they 51*35116Smarc were aliases. On BSD Unix echo will behave like "print -R" if 52*35116Smarc echo would "whence" to /bin/echo if it were not a built-in. The 53*35116Smarc PWD variable is no longer readonly but will be reset by cd. 54*35116Smarc 55*35116Smarc10. The -a option has been added to ulimit for BSD. This option can 56*35116Smarc be used to list all current resource limits. 57*35116Smarc 58*35116Smarc11. Process substitution, the ability to pass named pipes as command 59*35116Smarc arguments, has been documented even though it still does not work 60*35116Smarc on all UNIX systems since it requires the /dev/fd directory. 61*35116Smarc 62*35116Smarc12. The shell now uses the LINES parameter to control printing of 63*35116Smarc select lists. When possible, select tries to use about two-thirds 64*35116Smarc of the number of LINES. kill -l now uses select list format with 65*35116Smarc numbers representing the signal number. 66*35116Smarc 67*35116Smarc13. There have been a number of additions and changes to the emacs edit 68*35116Smarc mode. The command M-C has been change to M-c and the command M-l 69*35116Smarc has been added to convert to lower case. Several of the M- commands 70*35116Smarc not allow numeric parameters. M-= has been added to list the files 71*35116Smarc matching the current word. In the BSD version, the character ^Y 72*35116Smarc can now be used as an editing character. 73*35116Smarc 74*35116Smarc14. Errors on some built-ins now cause a shell script which contains 75*35116Smarc them to abort. The details as to which ones are in the manual page. 76*35116Smarc 77*35116Smarc15. A shell variable SECONDS has been added which is incremented every 78*35116Smarc second. Initially it is set to zero but you can assign to it to 79*35116Smarc reset it. It is an integer variable. 80*35116Smarc 81*35116Smarc16. The shell now prints the line number on error messages. This should 82*35116Smarc aid debugging scripts. 83*35116Smarc 84*35116Smarc17. The execution trace flag, -x, is no longer remains on when executing 85*35116Smarc shell functions. Instead, any function which has the -t attribute 86*35116Smarc turned on (typeset -ft <name>), will cause the trace flag to be turned 87*35116Smarc on for the function <name>. 88*35116Smarc 89*35116Smarc18. You can now do expansions for multi-digit positional parameters. 90*35116Smarc However, you must include the number in braces. Thus, ${11} gives 91*35116Smarc the eleventh positional parameter and eval '$'{$#} gives the last. 92*35116Smarc 93*35116Smarc19. The code has been reorganized somewhat and generates far fewer lint 94*35116Smarc warnings. There is more automatic feature configuration and there 95*35116Smarc is a 4th generation makefile included for those who have fourth 96*35116Smarc generation make available. A VFORK compile option is available 97*35116Smarc which causes the shell to use vfork() instead of fork() whenever 98*35116Smarc possible. This is now the default mode for apollo UNIX. The shell 99*35116Smarc no longer uses the segmentation violation faults internally so there 100*35116Smarc should be fewer "no space" messages. 101*35116Smarc 102*35116Smarc20. The y and Y commands have been added to the vi-edit mode. A new command 103*35116Smarc = has been added which prints a select list of files matching the 104*35116Smarc current word. The @ command has been added to allow macro definitions. 105*35116Smarc Some modifications have been made to speed up screen updates at 106*35116Smarc slower baud rates. 107*35116Smarc 108*35116Smarc21. When the shell is invoked as sh prog a path search is now performed 109*35116Smarc on prog. 110*35116Smarc 111*35116Smarc22. There is a new command substitution syntax $(command). The old `` 112*35116Smarc syntax is still supported and is completely compatible with the SVR2 113*35116Smarc shell. The new syntax allows anything within () without quoting 114*35116Smarc since this quoting nests. Thus, "$(" $()")" is legal and performs 115*35116Smarc a nested command substitution. Any old script which has a $( 116*35116Smarc within "" must prepend a \ in front of the $ to make it work for 117*35116Smarc ksh-i. The script will continue to run under the SVR2 shell. 118*35116Smarc 119*35116Smarc23. The variable _ is set to the file name of the command exec'd in 120*35116Smarc the environment. Thus, any program can find its binary file whenever 121*35116Smarc it is invoked by the shell. 122*35116Smarc 123*35116Smarc24. Bugs fixed in all versions. 124*35116Smarc a. An insidious bug which, on rare occasions, caused cd to fail 125*35116Smarc without any indication has been fixed. This bug only 126*35116Smarc occurred with certain environments. Its only reports happened 127*35116Smarc in conjunction with a recursive make procedure. 128*35116Smarc 129*35116Smarc b. A shell invoked as sh -c 'program <<! 130*35116Smarc anything 131*35116Smarc ! ' 132*35116Smarc no longer gives a 'cannot open' on a temporary file. 133*35116Smarc 134*35116Smarc c. The whence command didn't work correctly when there was 135*35116Smarc a command in the current directory with the name of a 136*35116Smarc tracked alias and the current directory came before the 137*35116Smarc path of the tracked alias in the path. 138*35116Smarc 139*35116Smarc d. The first argument of a for list was not always processed 140*35116Smarc correctly. For example, x='*';for i in "$x";do ...;done 141*35116Smarc did not correctly expand $x. 142*35116Smarc 143*35116Smarc e. If a / was quoted, then file name generation did not 144*35116Smarc take place in some instances, for example 'dir/'* did 145*35116Smarc not expand. It does this correctly now. 146*35116Smarc 147*35116Smarc f. The trackall option was inadvertently getting turned on 148*35116Smarc by default. The default should be off in the interactive 149*35116Smarc mode 150*35116Smarc 151*35116Smarc g. The pattern */dir did not expand if * matched a directory 152*35116Smarc which was searchable but not readable. As long as dir 153*35116Smarc doesn't contain any special pattern characters, read 154*35116Smarc permission is not needed for any directory matching */ 155*35116Smarc 156*35116Smarc h. If an alias x='name=value command' was defined, then 157*35116Smarc name2=value2 x did not work correctly. 158*35116Smarc 159*35116Smarc i. Shift and . no longer leave side effects when used with 160*35116Smarc command substitution. 161*35116Smarc 162*35116Smarc j. The typeset command invoked with certain invalid options 163*35116Smarc will no longer cause the shell to dump core. 164*35116Smarc 165*35116Smarc k. If a script contains two calls to a function with both file 166*35116Smarc descriptor zero and one redirected, then file descriptor 1 now 167*35116Smarc gets restored after the second function call. 168*35116Smarc 169*35116Smarc l. Signal table names are taken from /usr/include/sys/signal.h at 170*35116Smarc compile time so systems that use non-standard signal numbers 171*35116Smarc should work OK with ksh-i. You can now set traps on signal 11 172*35116Smarc since the shell no longer uses this signal internally for 173*35116Smarc its own stack management. 174*35116Smarc 175*35116Smarc m. A cd to a relative directory in the /etc/profile or .profile 176*35116Smarc before the PWD variable was set caused you to wind up in the 177*35116Smarc wrong directory. This has been fixed. 178*35116Smarc 179*35116Smarc n. The ignoreeof option now ignores eof from the secondary prompt. 180*35116Smarc 181*35116Smarc o. A shell invoked as sh -c " 182*35116Smarc command1 183*35116Smarc command2 184*35116Smarc " 185*35116Smarc no longer exits after command1 completes. 186*35116Smarc 187*35116Smarc p. An r of an incomplete compound command no longer causes the 188*35116Smarc shell to die after the unexpected eof message. 189*35116Smarc 190*35116Smarc q. Assignments of negative numbers with let no longer result it 191*35116Smarc large positive numbers. let x=-3;echo $x now yields -3. 192*35116Smarc 193*35116Smarc r. Interactive shells now work correctly the standard input is 194*35116Smarc a pipeline. Previously interactive shells tried to buffer 195*35116Smarc standard input. 196*35116Smarc 197*35116Smarc s. In vi mode the line you are currently typing is not lost 198*35116Smarc if you move back in the history list. Also, operations with 199*35116Smarc the last word of a line when it ended in a non-alphanumeric 200*35116Smarc character now works correctly. 201*35116Smarc 202*35116Smarc t. The PPID variable now works correctly no matter how a script 203*35116Smarc in invoked. 204*35116Smarc 205*35116Smarc u. r old=new commands now print out the command before it does 206*35116Smarc the execution. 207*35116Smarc 208*35116Smarc v. If a local variable within a function is exported, then 209*35116Smarc the local value gets passed. Previously, the original 210*35116Smarc value of the value got passed in the environment. 211*35116Smarc 212*35116Smarc w. exec ksh <<! 213*35116Smarc ! 214*35116Smarc no longer causes a /tmp file to be left behind. 215*35116Smarc 216*35116Smarc x. A bug which sometimes gave a "no space" message when the 217*35116Smarc "read" command was redirected or in a loop that was 218*35116Smarc re-directed has been fixed. 219*35116Smarc 220*35116Smarc y. The jobs number and process id message for background jobs 221*35116Smarc sometimes went to the standard output channel. They now 222*35116Smarc always go to stderr. 223*35116Smarc 224*35116Smarc z. The jobs command can now be used in a pipeline. 225*35116Smarc 226*35116Smarc aa. 2>&1 cmd >file is now equivalent to cmd 2>&1 >file. In the 227*35116Smarc Bourne shell and in earlier versions of ksh, the order of 228*35116Smarc redirection was reversed in the first form. 229*35116Smarc 230*35116Smarc bb. Open file descriptors for units above two no longer get 231*35116Smarc closed on exec for compound commands. Thus, the command 232*35116Smarc { command1;command2;} 7> file will no leave unit 7 open for 233*35116Smarc command1 and command2. 234*35116Smarc 235*35116Smarc cc. A bug in printing the ulimit on 16-bit machines has been fixed. 236*35116Smarc 237*35116Smarc dd. The command substitution `< file*` now expands when there 238*35116Smarc is exactly one matching file. 239*35116Smarc 240*35116Smarc ee. The shell now checks for running out of open file descriptors 241*35116Smarc internally and prints out a message. 242*35116Smarc 243*35116Smarc ff. The ulimit -p now gives the correct error on systems that 244*35116Smarc don't support this option. 245*35116Smarc 246*35116Smarc gg. Unsetting the highest element of an array, no longer causes 247*35116Smarc ${array[*]} from producing a bad subscript error. 248