shell
traditional Bourne shell family / history and development
Bourne
| Shells
| #!
| ash
| find
| ARG_MAX
| portability
| permissions
| UUOC
| -
| ../Various
| HOME
"$@"
| $() vs )
| IFS
| echo
| tty defs
| tty chars
| using siginfo
| nanosleep
| line charset
| locale
The Traditional Bourne Shell Family
History and Development
2008-04-15 (see recent
changes)
This page is about all the variants of the original Bourne
shell - it doesn't deal with bourne compatible shells like the
korn (ksh), almquist (ash), bourne again (bash) or posix shell.
The Bourne shell, introduced with the "7th edition" of Unix,
is an important part of the Unix history. Its grammar is the core
of several modern shells. Even some later variants of
the traditional Bourne shell are in use until today. However,
there's little common knowledge about all these variants, because
they never had been "versioned" -- this page tries to document their way.
Originally, this started with a rough english translation of
<3B9529F8.2RV1IN16U@bigfoot.de>
from de.comp.os.unix.shell.
Credits for that posting and for countless further comments
to Gunnar Ritter. Without The Unix Heritage Society
(TUHS) the early releases couldn't
have been documented in detail here. Many thanks also to Dennis
Ritchie for documentation about the Version 8 shell and to
Warren Toomey (TUHS) for documentation about the SVR1 shell.
Find more information about the origins
of the Bourne shell at the bottom of this page.
How to identify a traditional Bourne shell?
1
A simple check for an often undocumented but characteristic feature:
You can use the circumflex ^ (caret) as replacement for | (pipe).
See more common characteristics that are
unique to traditional Bourne shells. 2
[1]
Naturally, virtually all commercial systems provide
a traditional Bourne shell. Meanwhile, you'll find it at a different path
on some systems (e.g., HP-UX 10 ff., /usr/old/bin/sh)
or under the different name bsh (e.g., on AIX 4 ff. and
IRIX 6.4 ff.). On Ultrix you'll find a second variant as
/bin/sh5. On OSF1 there is the optional
/usr/opt/svr4/usr/bin/sh.
See also various system shells.
No rule without exception: HP stopped including it with release
"HP-UX 11i Version 1.5" (and Cray had stopped including it with
"Unicos 9").
[2]
If you're interested in general script portability, then have a look
at Paul Jarc's list of
suspicious or nonportable constructs concerning modern portable
script-writing.
Some subpages will be referred to concerning
selected issues.
I inspected the Bourne shell
on these unix systems (credits included).
If you can provide further information, i really would like to hear from you.
Thanks to the OpenSolaris project, Gunnar Ritter could publish
a source port of
a SVR4 variant of the Bourne shell. This is the first officially
available later Bourne shell on free unix flavours.
Todo: Bourne shell before Version 7 (unreleased) * ,
distinction between SVR3.0 and SVR3.2.
[*]
The Version 7 variant contains a char* version = "\nVERSION sys137 DATE 1978 Nov 6 14:29:22\n".
However, it's not used, remains unchanged in the source in following releases and disappears with SVR2
(source gets de-algol68ized).
The Variants
· Version 7 (2.9BSD)
and 3/4BSD (Ultrix sh, SunOS 2) - DomainOS 10.3
· System III (Plexus 1.0)
and SINIX
· SVR1
· SVR2 (Ultrix sh5, SunOS 3, MV/UX 3)
and Version 8 - OSF/1
- HP/UX
· SVR3 (MUNIX V3, SINIX 5.20, XENIX 2.3.4)
and SunOS 4 - AIX
- IRIX 3/4 - SCO Unix
- Interactive Unix
- DG/UX 40
- DomainOS 10.3
· SVR4 (Reliant 5.42, OSF1-SysV)
and SunOS 5 - IRIX 5/6
- DG/UX 42 - EP/IX
- Reliant UNIX
· SVR4.2 (UnixWare, OpenUnix)
The item "Version 7" lists some important
differences to its predecessors and successors.
All subsequent items try to list the differences to their
predecessor as complete as possible.
Version 7 shell ('79),
manual page,
This shell naturally looks rather old in comparison nowadays.
But here are differences to the Thompson shell.
The PWB aka Mashey shell is also mentioned; it evolved from the Thompson shell.
An important motivation for that actually was providing for large amounts of procedural automation.
The Thompson shell didn't have real control structures.
The PWB shell initially had if/switch/while, but called an
external goto to move the filepointer. As of mid'76, they were all built in.
redirections >& <& and <&-
(especially proper handling of stderr)
`...` (command substitution)
() and {}
here-documents (later versions of the PWB shell learned this from the Bourne shell)
eval
arbitrary variable names
(the PWB shell had variables, but only $a ... $m were available, apart from some more
predefined internal variables, like $p for path, e.g.)
variables can be exported into the environment (this was new with V7)
IFS
trap
(proper signal handling, onintr in the PWB shell
just called goto)
parameter substitutions ${-=?+}
export, flags envx
The Thompson shell had no umask.
The PWB shell might have added it in a later version.
PS2 functionality
A quick glance at differences to later variants:
without functions
without modern "$@"
no "unset" facility, i.e., no way to remove
variables from the environment (instead of assigning the empty value)
no "[" built-in available (even not as external command
on Version 7), but only the external "test"
numbersign, '#', is not a comment character yet
3
not 8-bit clean, but internally using the 8th bit for the quoting
mechanism 4
no /etc/profile (i.e., no global profile)
( Version 7, 2.9BSD )
[3]
Without '#', comments are only available by the null-command,
':' (colon), but naturally not without possible side
effects. A special example is ": `echo output 1>&2`"
[4]
A Bourne shell not being 8-bit clean shows subtle bugs, e.g., when
using ${b="$a"} with $a containing spaces:
The internal quoting mechanism sets the 8th bit for all characters
due to the doublequotes, thus $b won't contain real
spaces aymore. This then can be demonstrated with
"for i in $b; do echo $i; done": no word splitting
is done and you'll receive a single line of output.
...
BSD variations of the Version 7 shell,
"csh-hack": noninteractive shell execs /bin/csh if
the first character of an executable script is '#'
(the #! kernel
mechanism came later)
4.2BSD ('84) (and thus Ultrix sh, SINIX 5.20,
SunOS 1.x and 2.x):
comment character '#'.
4.3BSD ('86) (and thus 2.10 BSD ff):
comments only in noninteractive mode
between Ultrix-11 and Ultrix-3.1 sh:
"ulimit [-f]" built-in, /etc/profile
(all backported, the latter undocumented), newgrp
removed
( 3BSD ('80) until 4.3BSD-Reno 5,
Ultrix sh,
SINIX 5.20 6,
2.10BSDff. "backport",
SunOS 1.x and 2.x )
[5]
In the traditional BSD line, the Bourne shell was shipped
until 4.3BSD-Reno (but not anymore with Net/2 and the following 4.4BSDs).
For license reasons it was then substituted with the bourne-compatible,
svr4-like ash by Kenneth Almquist.
[6]
SINIX offers three universes: "ucb",
"sie"(mens) and "xopen" (aka "att").
These provide shells from 4.2BSD, SystemIII and SVR3, respectively.
Here are some notes about
the sinix universes.
...
DomainOS variant based on 4.3 BSD,
environment variable SHENV: path of script
executed at invocation of each new shell
system specific built-ins ver
(handle universes)
rootnode (managing the
distributed aegis base)
and inlib (attach a library,
for then-called programs)
option -Dname=value: supply environment variables
(for calling from binary executables)
default PATH is ":/bin:/usr/bin:/usr/ucb:/usr/apollo/bin"
( DomainOS SR 10.3/10.4 7 )
[7]
DomainOS offers two universes: "bsd4.3" and "sys5.3" each providing
an according shell variant.
System III shell ('81)
/etc/profile
comment character '#'
test for NULL, i.e., the empty value (in contrast to unset)
with "colon" in parameter expansion, e.g.,
"${parameter:=word}"
built-in "test", aka "[", added
(the latter actually was always existent in code, but commented out)
negation in "[...]" , e.g., "[!0-9]"
(not documented yet)
"set" recognizes "--" as option
delimiter, for arguments with a leading "-"
or "+"
"set" knows "+" to unset a
respective switch
fork checking improved, new error messages
"cannot fork: too many processes" and "...: no swap space".
"read" strips the leading IFS characters (undocumented)
"read" recognizes multiple IFS characters as one
field delimiter when reading several variables (undocumented)
bugfix:
"if false ;then :;fi;echo $?" formerly
wrongly yielded the exit status of false
(essential fix for the "-e" flag)
bugfix:
when expanding "$@" (or ${1+"$@"}),
empty arguments are not discarded anymore (not to confuse with the
later, modern "$@")
bugfix:
"echo */" resulted in a SEGV if there were files
with metacharacters
here document with trailing dash "<<-" strips leading tabs
"restricted" functionality (and flag "-r") added.
The environment variable "SHELL" is inspected at start-up.
Formerly, the "-r" flag was accepted and even
listed under SYNOPSIS but neither implemented nor mentioned otherwise.
"exit" allows leaving an interactive shell now
"chdir" deactivated (undocumented)
bugfix:
superfluous ';' (and '; ;' etc.) are not accepted anymore
( System III,
PLEXUS 1.0 )
...
SINIX variant based on System III,
"read" doesn't strip the leading IFS characters
"read" doesn't recognize multiple IFS characters
as one field delimiter when reading several variables
"display" built-in identical to
the "echo" utility.
(The echo built-in comes in SVR2.)
error messages compiled in the
system wide language ("sysname -l").
"chdir" not deactivated
( SINIX 5.20 [6] )
SVR1 shell ('83), aka System 5.0
new built-in "ulimit"
"shift" accepts a number
"cd" knows CDPATH
bugfix:
if "-e" is set, a script called like a command
(i.e., not execed but forked) doesn't exit itself but return
bugfix:
here-documents now work in connection with asynchronous
commands (i.e., using & or ``)
reproduce with, e.g., "cat<a' >b" (was: "illegal io")
bugfix:
command substitution works if stdout is closed
new flags: "-afh"
bugfix:
readonly without arguments doesn't list the exported
variables anymore
new environment variables MAILCHECK, MAILPATH
background jobs are spawned with a nice value of 4
(undocumented and often deactivated in the makefile)
accounting and environment variable SHACCT
(not activated on Ultrix)
source code de-ALGOL68ized (and: original "VERSION sys137 DATE 1978 Nov 6 14:29:22" disappeared)
SunOS 3: "test" knows -h to check for symbolic links
SunOS 3: "test: too many arguments" added
between Ultrix-11 and Ultrix-3.1: newgrp removed
Ultrix 4.2: type output
for case in a function fixed
Ultrix 4.2: sets environment variable LOGNAME via getpwuid()
( Ultrix sh5, SunOS 3.x, MV/UX 3.01 )
...
"8th Edition Research Unix" variant
8 based on SVR2, aka
Version 8 shell ('84)
environment variable HISTORY, pointing to a writable
file, providing a history mechanism by
"=(1)"
type is replaced by whatis,
which produces output that can be re-evaluated by the shell
functions can be exported (in the same ways like variables)
new flag "-p": removing function-definitions imported
from environment, setting IFS back to default value
built-ins
"echo test hash pwd ulimit" and their
implications are gone
new built-in "builtin", assuring that nothing else is
called instead (e.g., a function),
also needed for "whatis"
modern "$@"
'{' and '}' are special
like '(' and ')',
i.e., syntactically equivalent (e.g., leading blank
and terminating delimiter aren't necessary anymore,
redirection may also appear at the left side)
negation in "[...]" with '^',
instead of '!', e.g., "[^0-9]"
unnecessary semicolons are ignored (not to confuse with the
null-command ':' and its side effects or with
";;" in "case" )
alternative pipeline character '^' is gone
no /etc/profile
no "restricted functionality"
(thus SHELL and "readonly" are also gone)
no "<<-" (strip leading tabs in here documents)
"cd" provides an automatic spell checker
bugfix:
"f()command>x" works (was: "syntax error").
Note that the redirection always, even with braces, ends
in the body, though. (also in POSIX.2)
type output
for case in a function fixed
MAILCHECK and MAILPATH are gone
(MAIL is kept)
( Version 8 )
[8]
Most modifications for the Version 8 shell were driven by the
motivation for a clean design.
Consequently, the fact that function calls overwrite the
positional parameters
was not changed.
...
OSF/1 variant based on SVR2 9,
8-bit clean; range expressions and character classes
with evaluation of LC_CTYPE/LC_COLLATE
character classes support the [:alpha:] notation
depending on the environment variable BIN_SH the shell
forks to a POSIX.2 compliant shell ("xpg4") or an optional SVR4-like
shell ("svr4").
(backported from SVR3?)
"fix": calling a function doesn't overwrite the
positional parameters anymore.
The documentation still describes the old behaviour, though.
(backported from SVR4?)
"ulimit" doesn't only know about file
size, but is implemented with the 4.2BSD/SVR4-like
getrlimit(2)
parameter substitution inside here-document inside command
substitution fixed
(backported from SVR3?)
modern variant of
bracket expression "[...]"
bugfix:
shell doesn't crash on "cat <<`...`" anymore
(and the backquotes have no special meaning)
(backported from SVR4?)
the shell doesn't refuse to start with invalid environment variables
"test" knows -L and -h to check
for symbolic links, and -e to check for existence
(backported from SVR3?)
bugfix:
The shell only becomes restricted if argv[0]
is rsh or -rsh
probably the only Bourne shell expanding "*/" and
".*/" to directories (apart from */.)
more detailed error messages for "cd"
(linked in from libc) instead of only "bad directory"
type returns false on "not found"
type output
for case in a function fixed
cd: too many arguments added
"umask: Improper mask" error message added
TIMEOUT mechanism activated
( OSF1/V4, V5 aka Digital UNIX aka Tru64 )
[9]
The Migration Guide
"
System V Environment for Digital UNIX Version 4.0." (560 kB PDF)
claims, that /bin/sh on OSF1/V4 and /V5 is a SVR3.2 shell.
However, it's missing some characteristic properties of this
shell (modern "$@", "getopts", the PATH fix
and "read: missing arguments").
After all, it looks like a SVR2 shell with numerous fixes/backports
from later variants.
...
HP-UX variant based on SVR2,
at least from HP-UX 8 on:
8-bit clean; range expressions and character classes
with evaluation of LC_CTYPE/LC_COLLATE
...and support for multi-byte locales
10.
character classes support the [:alpha:] notation
shell tracks LINES and COLUMNS based
on SIGWINCH
(backported from SVR3?)
modern variant of
bracket expression "[...]"
parameter substitution inside here-document inside command
substitution fixed
"test" knows -h to check for symbolic links
HP-UX 8 and 9: "pwd" knows "-H"
for socalled context dependent files, cdf(4)
you can't trap SIGCHLD (used internally)
"bugfix":
(not consequently) file descriptor 59 is used instead of
file descriptor 19 for internal purposes.
(backported from SVR3?)
bugfix:
The shell only becomes restricted if argv[0]
is rsh or -rsh.
( HP-UX (at least)8 - 11i Version 1.5 (aka 11.20), where the Bourne shell
was withdrawn )
[10]
To try the unicode support on HP-UX with a remote connection, you need
an according font and the ability to insert multi-byte characters.
Try Thomas Dickey's XFree86 Xterm with Markus Kuhn's fonts.
Set LC_COLLATE and LC_CTYPE after
looking at "locale -a" and also set "stty -istrip cs8".
SVR3 shell ('86),
modern "$@"
8-bit clean (i.e., not using the 8th bit for quoting anymore)
"fix":
calling a function doesn't overwrite the
positional parameters
anymore (implicitly documented)
"cd" with more detailed error messages:
"not a directory", "does not exist", "permission denied",
"Multihop attempted", "remote link inactive".
Formerly, there was only "bad directory".
new built-in "getopts"
bugfix: a trailing colon in PATH
did not
mean "." before (however, it should behave like execvp(2))
modern variant of
bracket expression "[...]"
IFS='\' wrongly doesn't split anymore
(demonstrate with var='x\y';set $var;echo "x:$1 y:$2")
bugfix:
the shell doesn't become restricted with 'r' somewhere in
argv[0], but only for rsh and -rsh.
"read" knows the error message
"missing arguments"
var=x;echo ${var-'$'} results in
"bad substitution"
(probably due to the changed internal quoting mechanism).
The same with '"' and '`' as values,
for all but the ":+" and "+" form of
parameter expansion.
( SCO Xenix 2.3.4,
SINIX 5.20 [6],
MUNIX V3 )
...
SunOS 4 variant based on SVR3,
no "ulimit" built-in
11
"test" knows -h to check for symbolic links
if /usr/5bin precedes /bin in
PATH, built-ins behave sysv-like
("test": string length with -l;
"echo": escape sequences,
-f checks for regular files instead of non-directories)
the shell cannot become restricted by argv[0] anymore (but only
by flag or $SHELL). restricted functionality
even not documented anymore.
(backported from SVR4?)
the shell doesn't refuse to start with invalid environment variables.
if "cd" fails due to permissions,
perror() is called, "Permission denied".
Otherwise "cd" still only knows "bad directory",
though.
"test: too many arguments" added
SunOS 4.1.x: character classification via
LC_CTYPE/LC_default added
SunOS 4.1.x: 8bit characters in diagnostics are written in a meta
notation, if they're considered unprintable according to LC_CTYPE;
for example "./(M-d): permission denied"
(instead of "./д" - example assumes your browser
supports iso-8859-1)
SunOS 4.1.x: type
output for case in a function almost fixed
SunOS 4.1.x: "chdir" reactivated (undocumented)
default PATH is ":/usr/ucb:/bin:/usr/bin"
( SunOS 4 )
[11]
On SunOS 4, the "ulimit" built-in is not implemented at all.
getrlimit(2) lists this under BUGS
(but in fact this origins from 4.2BSD).
File size limits are catched with quotas instead, and apparently Sun
didnt't want to add support by getrlimit(2) otherwise.
...
AIX variant based on SVR3,
"test" knows -L to check for symbolic links
(at least from AIX 3.2 on) range expressions and character classes
with evaluation of LC_CTYPE/LC_COLLATE
(at least from AIX 3.2 on) (backported from SVR4?)
"ulimit" is implemented with the 4.2BSD/SVR4-like
getrlimit(2)
bugfix
(at least from AIX 3.2 on):
shell doesn't crash on "cat <<`...`" anymore
(and the backquotes have no special meaning)
parameter substitution inside here-document inside command
substitution fixed
mixed variant of
bracket expression "[...]"
bugfix: IFS='\' splits correctly again
behaviour about trailing colon in PATH not fixed
multibyte-aware version in /usr/mbin
(at least from AIX 3.2 on) error messaged for "cd"
linked in from libc
(at least from AIX 3.2 on) TIMEOUT mechanism activated
bugfix:
${var-'$'} and related parameter expansions bugs
(which were introduced with SVR3)
type returns false on "not found"
AIX 1.3 (but not anymore at least from 3.2 on):
"migrate" for migrating processes to other "sites".
"setspath" for using different "sites".
"setxvers" for setting an
"experimental version prefix" (in connection with
using "hidden directories").
In contrast to the documentation, "onsite" is not
implemented.
AIX 1.2: the only SVR3 variant that lacks
"read: missing arguments"
type output
for case in a function fixed
( AIX 1.2 ff. )
...
IRIX variant based on SVR3,
additional built-ins "limit" and "unlimit"
as interface to getrlimit(2)
"test" knows -l to check for symbolic links
( IRIX 3.3, 4.0.1 )
...
SCO Unix / OpenServer variant based on SVR3,
SCO Unix 3.2x, about '92:
flag "-L" for "cd" and "pwd"
added, toggling between using logical or physical pathnames,
i.e., wether navigation along symbolic links is remembered
"cd" provides a spell checker (inherited from Xenix)
possible setting of EUID/EGID to the RUID/RGID disabled
SCO Unix 3.2v4.2 / Open Desktop 3.0, '93:
bugfix:
Bourne shells use file descriptor 19
for internal purposes without error checking.
Now the highest fd is taken instead (if available)
or the error message "cannot open any more files" is printed.
"test" knows -L and -h to check
for symbolic links
range expressions and character classes with evaluation
of LC_CTYPE/LC_COLLATE
OpenServer 5.0.0, '95:
"test" knows -H and -M to check
for a semaphore or shared memory, respectively
bugfix:
shell doesn't crash on "cat <<`...`" anymore
(and the backquotes have no special meaning instead)
"umask -S" knows the symbolic notation.
"Bad umask" error message added.
OpenServer 5.0.5, '98:
shell tracks LINES and COLUMNS based on SIGWINCH
OpenServer 5.0.7, early '03:
shell tries to avoid SIGSEGV for internal memory management
to better recognize real SIGSEGVs. Instead it's checking and
expanding in advance.
OpenServer 6.0.0
"ulimit" implemented with getrlimit(2)
The shell also becomes restricted if argv[0]
is rshell or -rshell
( SCO Unix 3.2, Open Desktop 3, OpenServer 3, 5, 6 )
...
Interactive Unix variant based on SVR3,
searches DOSPATH for .exe, .cmd
and .bat
( Interactive Unix 4.0 )
...
DG/UX 4.0 variant based on SVR3 (probably a DG/UX 3.9 shell),
provides command line editing & history, called EDITREAD
still with old "cd" error message
"bad directory" only.
Perhaps this points to the need for distinction between
early and later SVR3 release, let alone SVR3.0 vs. SVR3.2.
( DG/UX 4.0 )
...
DomainOS variant based on SVR3,
environment variable SHENV: path of script
executed at invocation of each new shell
system specific built-ins
ver
(handle universes)
rootnode (managing the
distributed aegis base)
and inlib (attach a library,
for then-called programs). These built-ins are undocumented in
the SVR3 universe; the links show the BSD manpages.
option -Dname=value: supply environment variables
(for calling from binary executables)
default PATH is ":/bin:/usr/bin:/usr/apollo/bin"
( DomainOS SR 10.3/10.4 12 )
[12]
DomainOS offers two universes: "bsd4.3" and "sys5.3" each providing
an according shell variant.
SVR4 shell ('88),
with job control 13
and the according built-ins
"bg fg jobs kill stop suspend"
undocumented flag "-m" to switch on/off
job control.
"ulimit" now implemented with getrlimit(2)
new flag "-p"
If this flag is present, system and global profile are
not run (undocumented).
If this flag is not present and the effective uid is smaller
than 100 and different from the real uid, then the euid is reset
to the ruid; similarly for the e/rgid (undocumented).
"trap" now accepts symbolic signal names
"test" knows -h to check for symbolic links.
bug: redirecting to a file after the colon command
(": > file") in a for- or while-loop is executed
only the first time
bugfix: the shell now also adds 'r' to its flags
(i.e., to $-) when becoming restricted
by SHELL or argv[0]
the shell doesn't refuse to start with invalid environment variables,
e.g., for "env 'A B=1' sh"
("not an identifier").
Such variables are not passed on, though.
"chdir" reactivated (probably inherited from SunOS 4
- Sun was involved in SVR4), but except for SunOS 5 not documented
due to job control, signals are checked after
has been received. Before that they were only checked when a command
(at least the null-command) got executed.
ReliantUnix (at least >> 5.42):
bugfix: shell doesn't crash on "cat <<`...`" anymore
ReliantUnix (at least >> 5.42):
type output
for case in a function fixed
(
AT&T SVR4,
ReliantUnix 5.42,
OSF1: optional "System V Environment"
)
[13]
If you run an older shell without job control:
Don't forget about nohup(1).
However, background jobs are not in a new process group,
which has again a strong influence on signal handling.
...
SunOS 5 variant based on SVR4,
SunOS 5.1: bugfix:
shell doesn't crash on "cat <<`...`" anymore
(and the backquotes are evaluated immediately)
SunOS 5.1: bugfix:
"case x in in)" doesn't fail anymore with
syntax error
SunOS 5.1: mimics BSD builtins if /usr/ucb/
precedes /bin/, /usr/bin/ and
/usr/5bin/ (SunOS4/BSD compatibility):
"echo" knows "-n" and disables backslash escape sequences,
"test -f" doesn't check for a regular file but for "not a directory".
On "Solaris x86" this is also triggered if
SYSV3 is present in the environment
(labeled "SCO x86 compatibility support").
SunOS 5.1: type returns false on
"not found"
SunOS 5.6: "bugfix":
"2>&1 program >/dev/null" doesn't redirect
stderr to /dev/null anymore.
SunOS 5.6: redirection "echo a > file1 b > file2"
fixed.
SunOS 5.6: redirection "<>" fixed and
documented (used in /etc/inittab f.i.). In fact this syntax was
accepted but not implemented properly and undocumented since V7.
Search for IORDW in the source: O_RDWR
was missing.
SunOS 5.7: IFS not inherited from environment anymore.
SunOS 5.8: pfsh functionality added
(profiles for extended access control management)
SunOS 5.9: bugfix: When creating temporary files for here-documents
("/tmp/sh{PID}{num}"), the shell doesn't follow
unresolved symbolic links with the same name anymore
if they already exist, but choses a different name instead.
SunOS 5.9: "test" knows "-L" (in addition
to "-h")
( SunOS 5 )
...
Irix 5/6 variant based on SVR4,
"ulimit" not implemented with getrlimit(2),
but still with "limit" and "unlimit"
"test" knows -L and -l
in addition to -h
type returns false on "not found"
provides ${parameter##pattern} expansion, for the
pattern "*/" only. The reason is: /sbin/builtin_exec
reads '${0##*/} "$@"' and there are softlinks pointing
to this file with the name of the POSIX.2 built-ins.
apparently this variant is derived from between SVR4 and SVR4.2:
it knows "echo -n" (not very significant)
"type" reports "priv" and "mldmode" as built-ins.
But in fact they are disabled: you get "Unknown builtin"
when calling them.
the SVID strings "UX:sh", "ERROR:",
"WARNING", etc are
contained in the binary, but not activated
(contrary to the jsh(1) notes).
( IRIX 5 and 6 )
...
DG/UX variant based on SVR4,
provides command line editing & history, called EDITREAD
(possibly only in DG/UX)
"readt" built-in (timing out)
TIMEOUT mechanism activated
flag "-p" removed,
because privileges are handled differently in DG/UX
knows about the SVID "UX:sh:" messages and
thus seems to originate from between SVR4.0 and SVR4.2
( DG/UX 4.2 )
...
EP/IX variant based on SVR4,
knows about the SVID "UX:sh:" messages and
might originate from between SVR4.0 and SVR4.2
additional flags (only documented in printed manual):
"I" prints a terse summary about
resource usage
of the current session after each command
"J" activate job control (like "m")
"E" EOF doesn't exit an interactive shell
"B" mimics BSD echo built-in (see below)
"T" activates tilde expansion
mimics BSD builtins if /usr/ucb/
precedes /bin/, /usr/bin/
in PATH:
"echo" knows "-n" and disables backslash escape sequences,
"test -f" doesn't check for a regular file but for "not a directory".
type output
for case in a function fixed
default PATH is "/usr/net:/usr/bin:/usr/ucb"
( EP/IX 2.2.1AA )
...
Reliant UNIX variant based on SVR4,
provides character classes like "[[:alpha:]]",
including the equivalence and collation symbol,
"[[=c=]]" and "[[.cc.]]"
builtin "suspend" sends SIGTSTOP
manual page considerably enhanced
type output
for case in a function fixed
( Reliant UNIX 4.32 )
SVR4.2 shell ('92),
"read" knows the flag "-r"
with the SVID error message "UX:sh: ERROR: ..."
(years after the first definition in the SVID)
SVR4.2MP/UnixWare2.1/'95: "mldmode" and "priv"
SVR4.2MP/UnixWare2.1/'95: "umask -S" knows the
symbolic notation. "Bad umask" error message added.
UnixWare(-speciality?):
"foo=`echo $bar` bar=text" results in foo being empty:
"order of evaluation for variable assignments is changed to use
left to right expansion rules."
UnixWare, OpenUnix8: TIMEOUT mechanism activated
(the unit is seconds in contrast to minutes in previous shell versions)
UnixWare, OpenUnix8:
type returns false on "not found"
( UnixWare, OpenUnix 8 )
Origins of the Bourne shell
See an article from John Mashey
in net.unix-wizards ('86). By the way, the PWB (aka Mashey) shell from the
Programmer's Workbench, about "PWB 1.0", is also archived by TUHS
(see PDP-11/Distributions/usdl/).
See also an
article by David Korn ('94) with an interesting second chapter
concerning the Bourne shell history. 14
[14]
The article mentions that functions were added to the Bourne
shell in 1982. This might have been internal work at that
time or a typo in the article. SVR2 was actually released 1984.
The Bourne shell would probably be in much wider interactive
use today, if it provided line editing (and a history mechanism).
Having the above article in mind, this was - like with ksh originally -
probably not done in the hope that these features would move into the
terminal driver. Kenneth Almquist even
intentionally released his ash without line
editing and history for this reasons.
Predecessors
See manual pages
of two main predecessors of the Bourne shell,
the "Thompson" and the PWB shell:
Version 3 Thompson shell manual
(1/15/73).
Pipes are denoted by < and >.
(comments from Normal Wilson on TUHS list.)
Version 4 Thompson shell manual (4/18/73).
Here, pipes are denoted by ^ and |.
(DMR about this
on his pages
and at
TUHS.)
Version 6 Thompson shell manual (5/15/74).
Programmers Work Bench PWB shell manual
(5/31/77).
(for convenience here again the Version 7
Bourne shell manual)
See Jeffrey A. Neitzel's pages
for both an enhanced, backward-compatible port of the Thompson shell and a
port of the original source, which compiles on current systems.
As excellent illustration, you'll even find some
example scripts
there.
For more details about Version 6, see also a
V6 simh tape and an extensive V6 manual collection on
Wolfgang Helbig's pages.
sbrk() vs. SEGV
Before i found Geoff Collyer's paper with very informative details
about the memory management (see below), I collected some enlightening notes
from usenet about the famous
memory management implemented by means of trapping SIGSEGV
and calling sbrk(2)
Source code
Meanwhile the early Unix variants have become available in source
under a BSD-like license from SCO, have a look at
TUHS.
Usually you will not be able to
easily compile earlier Bourne shells on a modern unix variant, as
it is really oldfashioned C code with wild pointer management. Also, the
internal memory management crashes malloc used in libc
nowadays. And last but not least, directories are accessed differently.
The source is also odd to read without preprocessing
(e.g., it is made "algol-like" with preprocessor macros). Apart from
just running Version 7 and its shell in an emulator like simh,
you could also check the following:
Geoff Collyer provides
a source package
of the V7 shell (local copy)which should compile on most POSIX systems.
He has updated the memory management and directory-access code with parts
from his V9 shell. However he has added a few minor modifications, so this
variant is not completely original.
He has also published
"a partial tour through
the unix shell" (local copy), which is quite helpful
if you want to get busy with the source. It emphasizes the memory management but
also contains general hints.
Thanks to the OpenSolaris project, Gunnar Ritter could publish
a source port of
a current Bourne shell. This is the first officially available
later Bourne shell on free unix flavours.
Sven Mascheck
разделы
дмитрий шумок
мытье потолок
компания сент-люсии
заказать обед
северный корона
корпоративный хранилище данный спирли
избавиться спам
мэш
сварочный пост
заказать флаг
mobil pegasus
thuraya
измеритель температры
покраска рчв
микросреда компания
вилатерм
клеить 88 люкс
прибор крыса
билет большой
фирменный флаг
фирменный флаг
эдас-134 аденома предст.ж-зы
кожгалантерея
асбест а7-450
вымпел
компания петрокатридж
красный площадь гум
protherm
восстановление бухучета
компания сент-лючии
генерация кислорода
туба машина
купить стиральный
букмекерский контора фаворит
бейсболки заказ
пвс
восстановление потенция
компания сент-лючии
московский флаг
близорукость
стелаж
изготовление пленка
сервис alfa laval
оповещение
индивидуальный сейфовые ячейка
фотопечать
билет хоккей
shell