Shell Differences

  1. Unix Shell Scripting
  2. Shell Basics
  3. Testing in bash
  4. Capturing User Input
  5. Scripting : Exercise 1
  6. Debugging
  7. Bourne/Bash/Korn Commands
  8. Shell Variables
  9. IO Redirection
  10. Pipes
  11. Operators, Wildcards and Expressions
  12. Flow Control
  13. Scripting : Exercise 2
  14. Shell Differences
  15. String Functions
  16. awk
  17. xargs
  18. Power Tools
  19. Exercise 3

Differences in the Bourne and bash Shell Scripting Environments

Major differences between Bourne and bash at http://www.faqs.org/docs/bashman/bashref_122.html: (emphasis added)

Bash implements the ! keyword to negate the return value of a pipeline. Very useful when an if statement needs to act only if a test fails.

 

Bash includes the Posix and ksh-style pattern removal %% and ## constructs to remove leading or trailing substrings from variables.

The Posix and ksh-style $() form of command substitution is implemented, and preferred to the Bourne shell’s ” (which is also implemented for backwards compatibility).

Variables present in the shell’s initial environment are automatically exported to child processes. The Bourne shell does not normally do this unless the variables are explicitly marked using the export command.

The expansion ${#xx}, which returns the length of $xx, is supported.

 

Bash allows you to write a function to override a builtin, and provides access to that builtin’s functionality within the function via the builtin and command builtins.

The umask builtin allows symbolic mode arguments similar to those accepted by chmod.

The test builtin is slightly different, as it implements the Posix 1003.2 algorithm, which specifies the behavior based on the number of arguments.

Bourne and bash features at 
http://www.math.utah.edu/docs/info/features_1.html#SEC8
: (emphasis added)

Bash implements essentially the same grammar, parameter and variable expansion, redirection, and quoting as the Bourne Shell. Bash uses the POSIX 1003.2 standard as the specification of how these features are to be implemented. There are some differences between the traditional Bourne shell and Bash; this section quickly details the differences of significance. A number of these differences are explained in greater depth in previous sections. This section uses the version of sh included in SVR4.2 as the baseline reference.

* Bash is POSIX-conformant, even where the POSIX specification differs from traditional sh behavior (see section 6.11 Bash POSIX Mode).

* Bash has command history (see section 9.1 Bash History Facilities) and the history and fc builtins to manipulate it.

* Bash includes brace expansion (see section 3.5.1 Brace Expansion) and tilde expansion (see section 3.5.2 Tilde Expansion).

* Bash implements command aliases and the alias and unalias builtins (see section 6.6 Aliases).

* Bash provides shell arithmetic, the (( compound command (see section 3.2.5 Conditional Constructs), and arithmetic expansion (see section 6.5 Shell Arithmetic).

* Variables present in the shell’s initial environment are automatically exported to child processes. The Bourne shell does not normally do this unless the variables are explicitly marked using the export command.

* Bash includes the POSIX pattern removal `%’, `#’, `%%’ and `##’ expansions to remove leading or trailing substrings from variable values (see section 3.5.3 Shell Parameter Expansion).

 

* It is possible to have a variable and a function with the same name; sh does not separate the two name spaces.

* Bash contains the `<>’ redirection operator, allowing a file to be opened for both reading and writing, and the `&>’ redirection operator, for directing standard output and standard error to the same file (see section 3.6 Redirections).

* The noclobber option is available to avoid overwriting existing files with output redirection (see section 4.3 The Set Builtin). The `>|’ redirection operator may be used to override noclobber.

* Bash includes a help builtin for quick reference to shell facilities (see section 4.2 Bash Builtin Commands).

* The test builtin (see section 4.1 Bourne Shell Builtins) is slightly different, as it implements the POSIX algorithm, which specifies the behavior based on the number of arguments.

* The Bash umask builtin permits a `-p’ option to cause the output to be displayed in the form of a umask command that may be reused as input (see section 4.1 Bourne Shell Builtins).

* Bash implements a csh-like directory stack, and provides the pushd, popd, and dirs builtins to manipulate it (see section 6.8 The Directory Stack). Bash also makes the directory stack visible as the value of the DIRSTACK shell variable.

How does bash differ from the Korn shell, version ksh88?
at http://www.unixguide.net/unix/bash/C2.shtml

Things bash has that Korn doesn’t;
Things Korn has that bash doesn’t;
strange features of both.

Differences between ksh, bash and different shells

at http://www.unix.com/answers-frequently-asked-questions/12274-difference-between-ksh-bash-different-shells.html

A very nice Google-sponsored breakdown.