Bourne | Ash |  #!  | find | ARG_MAX | Shells | whatshell | portability | permissions | UUOC | ancient | - | ../Various | HOME
"$@" | echo/printf | set -e | test | tty defs | tty chars | $() vs ) | IFS | using siginfo | nanosleep | line charset | locale


Characteristical common properties of the traditional Bourne shells

distinguishing them from bourne compatible shells


The purpose of this page is not to point out portability problems (this is a side effect) but to identify characteristic features; probably just for fun. Otherwise this page also would have to list what the bourne shell might share with one or a few other shells only. Instead, if you're interested in portability: Paul Jarc tries to document all the suspicious or nonportable constructs that can impact portable script-writing, and the autoconf documentation contains a chapter about portable shell programming. (The "#! /" issue in earlier releases likely is a myth, though.) Keep in mind that autoconf strictly aims at maximizing portability for install scripts, thus earlier versions even suggested to avoid all unportable extensions after Version7.

Content:

   Common to all versions
   Common to all versions since SVR1
   Common to all versions since SVR2 - related to functions
   Common to all versions since SVR2 - related to the unset built-in
   Common to all versions since SVR2 - related to the hash built-in
   Common to all versions since SVR2 - other issues
   Not exclusive to traditional Bourne shells (wrongly might be considered characteristical)


Common to all versions:


Common to all versions since SVR1:

(implementation of set -e changed)


Common to all versions since SVR2, related to the new functions:

Common to all versions since SVR2, related to the new "unset" built-in:

Common to all versions since SVR2, related to the new "hash" built-in:

Common to all versions since SVR2, other issues

  • Before SVR2, here-documents couldn't be run asynchronously (as part of a command substution here).

    For the following code there's a race condition:
    the right command of the pipeline (grep) might be starting before the temporary file containing the here-document was created.
    The shell then errors with a "/tmp/sh12345: cannot open"

        echo `cat <<EOF|grep x
        x
        EOF
        `
    

    If the here-document is also right part of a pipeline at the same time,
    then the probability to trigger the race was highly increased for me:

        echo `:|cat <<EOF|grep x
        x
        EOF
        `
    

    As exception, this was fixed on SunOS 5.5.


    Not exclusive to Bourne shells


    2014-10-11, <http://www.in-ulm.de/~mascheck/bourne/common.html>