[net.unix-wizards] shell history

Robert_Toxen%anvil.UUCP@harvard.harvard.edu (03/05/86)

Sorry, no! Bourne shell came before csh and Bill Joy incorporated Bourne's
ideas into csh, not the other way 'round.

My mistaken belief in the opposite order was corrected by Steve Bourne
personally.

Regarding poor service by Sun, encourage Sun to clean up their act by
cancelling outstanding orders and placing orders with their competition,
i.e. Silicon Graphics, Masscomp, Apollo, et al.

Bob Toxen
Stratus
{ucbvax!ihnp4,harvard}!anvil

chris@umcp-cs.UUCP (03/07/86)

In article <1512@brl-smoke.ARPA> Robert_Toxen%anvil.UUCP@harvard.harvard.edu
writes (in response to a somewhat qualified statement by me that csh was
written before sh):

>Sorry, no! Bourne shell came before csh and Bill Joy incorporated Bourne's
>ideas into csh, not the other way 'round.

Here (with permission) is a quote from Joe Kalash at UC Berkeley:

	The original versions of C shell were written on V6 computers
	here (at Berkeley). While it was written before V7 was
	brought up here (i.e. before Bill really had access to
	Bourne's sh), it was in fact written AFTER V7 was available.

So csh was written independently, at any rate.  There may have
been cross-fertilization afterward, but the original csh design
(if you can call it a design :-/) was not based on the V7 shell.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1415)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@mimsy.umd.edu

ed@mtxinu.UUCP (Ed Gould) (03/11/86)

Robert_Toxen%anvil.UUCP@harvard.harvard.edu:
>>Sorry, no! Bourne shell came before csh and Bill Joy incorporated Bourne's
>>ideas into csh, not the other way 'round.

Chris Torek:
>Here (with permission) is a quote from Joe Kalash at UC Berkeley:
>
>	The original versions of C shell were written on V6 computers
>	here (at Berkeley). While it was written before V7 was
>	brought up here (i.e. before Bill really had access to
>	Bourne's sh), it was in fact written AFTER V7 was available.
>
>So csh was written independently, at any rate.  There may have
>been cross-fertilization afterward, but the original csh design
>(if you can call it a design :-/) was not based on the V7 shell.

Well, we seem to be sneaking up on the truth, here.  Joe is right that
the genesis of csh predates V7, but it doesn't predate Bourne's sh.
Both csh and sh took ideas from Mashey's PWB shell.  Also, Bill talked
to folks at the Labs quite a bit in those days - there was definitely
a flow of ideas from Bourne to Joy, even if it wasn't direct.

-- 
Ed Gould                    mt Xinu, 2910 Seventh St., Berkeley, CA  94710  USA
{ucbvax,decvax}!mtxinu!ed   +1 415 644 0146

"A man of quality is not threatened by a woman of equality."

griff@cascade.ARPA (Peter Griffin) (03/14/86)

If csh was developed BEFORE sh, what shell was it developed under?

ed@mtxinu.UUCP (Ed Gould) (03/14/86)

In article <71@cascade.ARPA> griff@cascade.UUCP (Peter Griffin) writes:
>If csh was developed BEFORE sh, what shell was it developed under?

Why, sh, of course!  Actually the name sh has been applied to several
different programs.  In all Unix systems (at least from V5 on) there
is a shell named sh.  Bourne's "Algol" shell didn't get released until
V7.  There were also the V6 shell, and the PWB shell, and many others.
Csh's precursor was once called nsh, for "new" shell; it was basically
an enhanced V6 shell without csh's C-like syntax.  It may have even
been called sh on some machines.

When we first got V7 at UC, we considered abandoning the Bourne
shell, or perhaps renaming it, and installing csh as sh.  We finally
rejected the idea because there were too many scripts to convert, and
that the Bourne shell is a more efficient interpreter for scripts.

-- 
Ed Gould                    mt Xinu, 2910 Seventh St., Berkeley, CA  94710  USA
{ucbvax,decvax}!mtxinu!ed   +1 415 644 0146

"A man of quality is not threatened by a woman of equality."

ron@isieng.UUCP (Ronald P. Hughes) (03/14/86)

In article <71@cascade.ARPA> griff@cascade.UUCP (Peter Griffin) writes:
>If csh was developed BEFORE sh, what shell was it developed under?

Back in the days of Version 6 UNIX, there was a shell (/bin/sh) that
predated the Bourne shell.  I don't know if Steve Bourne was involved
in this earlier shell's development, but his new creation was intended
to be a superset of the old.  Old shell scripts ran successfully with
the Bourne shell, which is why he could get away with replacing the
old shell completely.  Csh could never replace sh because of syntactic
differences which would render old shell scripts obsolete (aside from
subjective differences of opinions as to which shell was "better").

The old shell source was only a few thousand lines long;  you could breeze
through the listings in long evening and have a pretty good idea of what
was going on.

Ronald P. Hughes    Integrated Solutions, Inc., San Jose    pyramid!isieng!ron

jdb@mordor.UUCP (John Bruner) (03/15/86)

In article <214@isieng.UUCP> ron@isieng.UUCP (Ronald P. Hughes) writes:
>Back in the days of Version 6 UNIX, there was a shell (/bin/sh) that
>predated the Bourne shell.  I don't know if Steve Bourne was involved
>in this earlier shell's development, but his new creation was intended
>to be a superset of the old.  Old shell scripts ran successfully with
>the Bourne shell, which is why he could get away with replacing the
>old shell completely....

Actually, the Bourne shell isn't a simple superset of the V6 (Thompson?)
shell.  In particular, the V6 shell only read input one character at
a time, so that all flow control could be implemented by programs which
did a seek() on the shell file (which was passed to them on the standard
input).  ("if", "goto", and "exit" were programs.)  Programs which read()
the standard input were also expected to do it one character at a time,
so that you could embed input to (for example) "ed" in the middle of the
shell file.  (There was no "<<".)  As I recall, the only built-in commands
were "chdir", "login", and "newgrp".  (I don't remember if ":" was built-in
or was an empty file in "/bin".)

This approach had its drawbacks, but I've always been impressed with
how much capability this very sparse design provided.

It may be true that the Bourne shell is a superset of the PWB 1.0
(Mashey?) shell; I had no opportunity to use it.
-- 
  John Bruner (S-1 Project, Lawrence Livermore National Laboratory)
  MILNET: jdb@mordor [jdb@s1-c.ARPA]	(415) 422-0758
  UUCP: ...!ucbvax!dual!mordor!jdb 	...!seismo!mordor!jdb

cja@umich.UUCP (Charles J. Antonelli) (03/17/86)

In article <214@isieng.UUCP> ron@isieng.UUCP (Ronald P. Hughes) writes:
>In article <71@cascade.ARPA> griff@cascade.UUCP (Peter Griffin) writes:
>>If csh was developed BEFORE sh, what shell was it developed under?
>
>Back in the days of Version 6 UNIX, there was a shell (/bin/sh) that
>predated the Bourne shell.  I don't know if Steve Bourne was involved
>in this earlier shell's development, but his new creation was intended
>to be a superset of the old. 

That old Version 6 UNIX shell was called the Mashey Shell, I believe,
after its creator John Mashey.  After the introduction of the then
brand new Bourne Shell with Version 7 there was a period of attitude
readjustment, confusion (the Mashey Shell was renamed msh for those who
didn't want to switch, the Bourne Shell was sometimes named bsh for
the same reason, both were occasionally named sh for maximal confusion),
Bourne Shell convertees walked around muttering that they had been Bourne
again (really), and a good time was had by all.

ka@hropus.UUCP (Kenneth Almquist) (03/17/86)

> Old shell scripts ran successfully with the Bourne shell, which is why
> he could get away with replacing the old shell completely.

Actually, they generally didn't.  I'll give an example of a pre-Bourne
shell script for those of you who are curious:

	/bin/if $1x = x /bin/goto usage
	[commands to do actual work go here]
	/bin/exit
	: usage
	/bin/echo "Usage: command filename"
	/bin/exit 1

Several commands here no longer exist.  The program /bin/if evaluated
conditional expressions.  The expression "$1x = x" tests whether $1
is the null string.  (This looks like a silly way to do this, I know.
I think that the reason it was done this way is that $1 would not be
expanded if it was enclosed in quotes.)  If the expression evaluated
to true, /bin/if would execute the specified program:  /bin/goto in
this case.

/bin/goto performs a goto, just like its name implies.  The implemen-
tation of /bin/goto depended upon the fact that the shell read shell
scripts on file descriptor 0 using unbuffered reads.  The /bin/goto
program would seek to the beginning of the script and read forward
until it came to the specified label, which appeared on a line begin-
ning with a ":".  The ":" command does nothing; it was actually a
shell builtin even at this early date.

/bin/exit was a very simple program.  It just seeked to the end of
file on its standard input.  The second example worked because sh
would use (and still uses) the exit status of the last command invoked
as its exit status, so "/bin/exit 1" would seek to the end of file and
then exit with status of 1, which would cause the shell to terminate
with the same status.

Needless to say, all this broke with the Borne shell, which didn't
read shell scripts on the standard input.  One reason that the Borne
shell was accepted as a replacement for the old shell is that in a
shell script of any size the gotos became unreadable.  The big change
in converting to the Borne shell consisted of replacing all the gotos
with structured flow of control statements, which was obviously a
worthwhile enterprise even if the Borne shell had not required it.
				Kenneth Almquist
				ihnp4!houxm!hropus!ka	(official name)
				ihnp4!opus!ka		(shorter path)

yoda@ittatc.ATC.ITT.UUCP (Todd C. Williams [Jedi Knight]) (03/18/86)

>	If csh was developed BEFORE sh, what shell was it developed under?

Probably (and this is a guess) Version 6's /bin/sh, "the mashey shell".

And just be glad that you don't have to do work using the mashey shell under
v6 UNIX in 1986, like I do.

						-Todd Williams
"The opinions are my own, not my employer's, but, then again, my employer
chooses to run v6 UNIX, so what does my employer's opinion matter?"

No offense intended to John Mashey!
-- 
+------------------------------------------------------------------------------+
|  Todd C. Williams			|  "Summer blonds		       |
|  ITT Defense Communications		|   revealing tan lines,	       |
|  Nutley, NJ				|   I'll make more moves than	       |
|  {decvax, et al.}!ittatc!dcdvaxb!tcw	|   ALLIED VAN LINES!"		       |
|  I love to receive e-mail from anyone!|     --from: "I wanna be a lifeguard" |
|					|			by BLOTTO      |
+------------------------------------------------------------------------------+

dave@onfcanim.UUCP (Dave Martindale) (03/19/86)

People have mentioned that the Bourne shell had better "programming"
(flow of control) structures than the old v6 shell.  Very true - it made
writing non-trivial shell files at least a bit saner job.

But nobody has mentioned what I considered the biggest incentive to change
over.  In the old, v6 shell, the standard input of any commands that were
invoked from a shell script was the shell script itself.  This was sometimes
convenient; that's how the control structures were implemented, and you could
put things like "ed" commands directly into the script (as long as the
program you were calling also read its input one character at a time - ed did).
But it meant that you could *not* write shell scripts that were to be
used as filters, even if their execute bit was set, since the standard input
of the shell at the time it was forked was no longer available.

The thing the Bourne shell did for the world was to start all of the child
processes invoked from a shell file with their standard input, output, and
error streams the same as the shell itself.  Thus, you could write filters,
and the desire to build new software out of already-existing pieces no
longer conflicted with the desire to make everything a filter if it could
possibly be used that way.

Look around your favourite UNIX system.  See how many shell-script filters
there are.

ed@mtxinu.UUCP (Ed Gould) (03/20/86)

>That old Version 6 UNIX shell was called the Mashey Shell, I believe,
>after its creator John Mashey.

Close, but not quite.  The V6 shell, as Mashey points out in his
first-hand account of this history, was a Thompson shell.  The PWB
(Programmer's Work Bench - a branch of V6 within the Labs) shell
was the one known as the Mashey shell.

-- 
Ed Gould                    mt Xinu, 2910 Seventh St., Berkeley, CA  94710  USA
{ucbvax,decvax}!mtxinu!ed   +1 415 644 0146

"A man of quality is not threatened by a woman of equality."

jsdy@hadron.UUCP (Joseph S. D. Yao) (03/25/86)

In article <5924@mordor.UUCP> jdb@mordor.UUCP (John Bruner) writes:
>Actually, the Bourne shell isn't a simple superset of the V6 (Thompson?)

My memory says "Ritchie."

>                              ...  As I recall, the only built-in commands
>were "chdir", "login", and "newgrp".

Originally, also "shift", "wait", ":".  Maybe "onintr", but I think
that that was a later add-on.  Folk in the community added many things
such as "cd", "set" or "=", "next" or "." or "source", "opt", "logout"
or "logoff", "detach", "^L" (ignored), and finally all the control
structures.

>It may be true that the Bourne shell is a superset of the PWB 1.0
>(Mashey?) shell; I had no opportunity to use it.

There's a lot different, though Bourne indubitably started with the
Mashey shell.  (Look it up in BSTJ whatever, which I don't have right
here.)  For the future of the shell, though, see the Korn shell plus
extensions paralleling that made by someone here on the Net.  (No,
neither is the infamous "Bourne-again" shell.)
-- 

	Joe Yao		hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP}

jsdy@hadron.UUCP (Joseph S. D. Yao) (03/25/86)

In article <14797@onfcanim.UUCP> dave@onfcanim.UUCP (Dave Martindale) writes:
>But nobody has mentioned what I considered the biggest incentive to change
>over.  In the old, v6 shell, the standard input of any commands that were
>invoked from a shell script was the shell script itself.  ...
>... it meant that you could *not* write shell scripts that were to be
>used as filters, even if their execute bit was set, since the standard input
>of the shell at the time it was forked was no longer available.

The Mashey shell under PWB 1.0 ("System I"), at least the version that
I and many others used, had the construct "< --" to allow one to read
the shell's original stdin.  This was very useful, for all the reasons
Dave mentions.  However, the Bourne mechanism seems better.
-- 

	Joe Yao		hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP}

jsdy@hadron.UUCP (Joseph S. D. Yao) (03/26/86)

In article <331@hadron.UUCP> jsdy@hadron.UUCP (I) write:
>In article <5924@mordor.UUCP> jdb@mordor.UUCP (John Bruner) writes:
>>Actually, the Bourne shell isn't a simple superset of the V6 (Thompson?)
>My memory says "Ritchie."

On better authority, Bruner was right and I was wrong.

>							  ...  (No,
>neither is the infamous "Bourne-again" shell.)

The "Bourne-again shell," to my knowledge, was a term jokingly used
after a talk by Dave Yost.  Dave noted that people's preference in
editors was largely a "religious issue" -- so he assumed the guise of
a preacher and tried to convert folk to the one, true, holy editor.
He was asked whether this required the Bourne-again shell.  I wasn't
aware that this term had passed into any more common usage.
-- 

	Joe Yao		hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP}

ron@isieng.UUCP (Ronald P. Hughes) (04/02/86)

*****

I think we're gonna have to start using a shell sort
to keep this all straight.