The fragmentation of the Unix marketplace has had its advantages and disadvantages. The advantages came mostly in the early days: lack of standardization and proliferation among technically savvy academics and professionals contributed to a healthy "free market" for Unix software, in which several programs of the same type (e.g., shells, text editors, system administration tools) would often compete for popularity. The best programs would usually become the most widespread, while inferior software tended to fade away.
But often there was no single "best" program in a given category, so several would prevail. This led to the current situation, where multiplicity of similar software has led to confusion, lack of compatibility, and -- most unfortunate of all -- Unix's inability to capture as big a share of the market as other operating platforms. In particular, Unix has been relegated to its current position as a very popular operating system for servers, but it's a rarity on desktop machines.
The "shell" category has probably suffered in this way more than any other type of software. As we said in the preface and Chapter 1, it is one of the strengths of Unix that the shell is replaceable, and thus a number of shells are currently available; the differences between them are often not all that great. We believe that the Korn shell is one of the best of the most widely used shells, but other shells certainly have their staunch adherents, so they aren't likely to fade into obscurity. In fact, it seems that shells, Bourne-compatible or not, continue to proliferate.
Therefore we felt it necessary to include information on shells similar to the Korn shell. This Appendix summarizes the differences between the Korn shell and the following shells:
The System V Release 4 Bourne shell, as a kind of baseline
The 1988 version of the Korn shell
The IEEE POSIX 1003.2 Shell Standard, to which the Korn shell and other shells adhere
The Desk Top Korn shell (dtksh), a Korn shell with enhancements for X Window System programming, as part of the Common Desktop Environment (CDE)
The tksh shell, an interesting blend of ksh93 with Tcl/Tk
pdksh, a widely used public domain version of the Korn shell
The bash shell, another enhanced Bourne shell with some C shell and Korn shell features
The Z shell, zsh, yet another enhanced Bourne shell with some C shell and Korn shell features and many, many more of its own
Korn shell workalikes on desktop PC platforms
The Korn shell is almost completely backward-compatible with the Bourne shell. The only significant feature of the latter that the Korn shell doesn't support is ^ (caret) as a synonym for the pipe (|) character. This is an archaic feature that the Bourne shell includes for its own backward compatibility with earlier shells. No modern Unix version has any shell code that uses ^ as a pipe.
 There are also a few differences in how the two shells react to certain extremely pathological input. Usually, the Korn shell processes correctly what causes the Bourne shell to "choke."
To describe the differences between the Bourne shell and the Korn shell, we'll go through each chapter of this book and enumerate the features discussed in the chapter that the Bourne shell does not support.
Tilde (~) expansion.
The Bourne shell always follows the physical file layout, which affects what happens when you cd .. out of somewhere that was a symbolic link.
The built-in commands don't have online help.
Some older versions of the Bourne shell don't support the jobs command and job control, or they may require being invoked as jsh in order to enable job control features.
set -o options don't work. The Bourne shell supports the abbreviations listed in the "Options" table in Appendix B, except -A, -b, -C, -m, -p, and -s.
Environment files aren't supported; neither is the print command (use echo instead). The following built-in variables aren't supported:
Some of these variables (e.g., EDITOR and VISUAL) are still used by other programs, like mail and news readers.
Indirect variables (namerefs) are not available.
The whence command is not available; use type instead.
The pattern-matching variable operators (%, %%, #, ##, etc.) and advanced (regular expression) wildcards are not available; use the external command expr instead.
Autoloaded functions are not available, and only POSIX-style functions (those defined using the name() syntax) may be used.
Command substitution syntax is different: use the older `command` instead of $(command). (Some vendors have enhanced their Bourne shells to support the $(command) notation, since it's defined by the POSIX standard.)
Conditional tests use older syntax: [ condition ] or test condition instead of [[ condition ]]. These are actually two forms of the same command (see the test(1) manual page).
The logical operators && and || are -a and -o instead. Supported test operators differ from system to system.
 In the original Version 7 Bourne Shell (and in Berkeley Unix systems through 4.3BSD), test and [ condition ] were actually external commands. (They were hard links to each other in /bin.) However, they've been built into the Bourne shell in all systems since System III (circa 1981).
The ! keyword to reverse the exit status of a command was not in the SVR4 Bourne shell, although it may be available on your system, since it is required by POSIX.
The select construct isn't supported. Neither is the arithmetic for loop, and there is no way to fall through from one case to another inside a case statement.
There is no equivalent for TMOUT.
Arithmetic isn't supported: use the external command expr instead of the $((...)) syntax. For numeric conditionals, use the old condition test syntax and relational operators -lt, -eq, etc., instead of ((...)). let isn't supported.
Array variables and the typeset command are not supported.
 The <> operator was in the original Version 7 Bourne shell, but not documented, since it didn't always work correctly across all Unix systems. Its availability should not be relied upon for Bourne shell programming.
print isn't supported (use echo instead). printf is generally available as an external command.
None of the options to read are supported, nor is the ability to supply a prompt with the first variable's name.
The Bourne shell does not do special interpretations of pathnames, such as /dev/fd/2 or /dev/tcp/ftp.oreilly.com/ftp.
The $"..." and $'...' quoting mechanisms are not available.
The - option to trap (reset trap to the default for that signal) is not available. Instead, a missing trap indicates that the supplied traps should be reset. trap accepts only signal numbers, not logical names.
Coroutines aren't supported.
The wait command only accepts process IDs.
set -n takes effect even in interactive shells.
The output from tracing with set -x is not customizable (no PS4 variable).
Discipline functions are not available.
The ulimit and umask commands are not as capable.
Copyright © 2003 O'Reilly & Associates. All rights reserved.