The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: mascheck@in-ulm.de (Sven Mascheck)
Subject: [TUHS] History of #! interpretation in Unix
Date: Sun, 16 Jan 2011 14:20:39 +0100	[thread overview]
Message-ID: <20110116132039.GA16484@lisa.in-ulm.de> (raw)
In-Reply-To: <20110116095548.GC3374@mercury.ccil.org>

John Cowan wrote:
> Warren Toomey scripsit:

> > the history of #! interpretation in System V. I couldn't find any #!
> > code in the kernels before SysVR4. 

> The feature was added to the 8th Research edition kernel,
> but didn't migrate to the System III/V line until SVR4.  

Thanks to you all.  Amazing, it came so "late".

> Shebangs began very early in BSD as a csh-only hack, but appeared
> as a config option in kernels as early as 2.8BSD, according to
> Wikipedia; 4.2BSD was the first release that turned them on by
> default.

In a usenet discussion with G.Ritter in '01 I noticed the first detailed
hint about the origin, and since then I've tried my best to document
the issue on http://www.in-ulm.de/~mascheck/various/shebang/#origin

(And although someone added some of the links I collected,
 I believe Wikipedia still has several things mixed up,
 while I'm quite busy to keep my own stuff consistent...)

4.0BSD had incorporated it originally among the BSDs.
2.8BSD came soon, sounds earlier, but after its original release,
2BSD was just a different development line (http://www.levenez.com/unix/unix_a4.pdf).

As you mention "shebangs began .. as csh-only hack":
I still wonder if one may call the BSD csh-hack as origin,
because #! might have been developed independently at Bell Labs.
(although, in turn, the idea might origin from Berkeley, as the
 interesting answer from DMR in the wikipedia article suggests.)
And BTW: it was not "csh-only", but sh was hacked symmetrically :)


> Perl has always (I think) had its own shebang support; you can get Perl
> to exec an arbitrary interpreter for a script provided it has a shebang.

The traditional ash, bash-1 (and -2 ff. as compile time option) also
implement that.


> Modern shells will use /bin/sh to run scripts that *don't* have shebangs,
> except for ksh which considers itself /bin/sh-compatible, and therefore
> runs such scripts itself.

I thought sh-like shells in general try to interprete scripts themselves
upon an ENOEXEC.  Do you know certain shells which actually call "/bin/sh"?

    Sven



  reply	other threads:[~2011-01-16 13:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-16  8:43 Warren Toomey
2011-01-16  9:55 ` John Cowan
2011-01-16 13:20   ` Sven Mascheck [this message]
2011-01-16 17:17     ` John Cowan
2011-01-16 19:19       ` Sven Mascheck
2011-01-16 20:17         ` John Cowan
2011-01-16 20:42           ` Larry McVoy
2011-01-16 21:08           ` Sven Mascheck
2011-01-16 21:37             ` John Cowan
2011-01-17 16:35               ` Warner Losh
2011-01-17 20:47                 ` John Cowan
2011-01-17 10:09           ` Tim Bradshaw
2011-01-16 10:53 ` Wilko Bulte
2011-01-17 16:25   ` Warner Losh
2011-01-17 19:02 ` Jeremy C. Reed
2011-01-17 20:51   ` John Cowan
2011-01-17 22:41     ` Jeremy C. Reed
2011-01-17 20:58   ` Sven Mascheck
2011-01-19  4:10   ` Cyrille Lefevre
2011-01-19 20:35     ` Sven Mascheck
2011-01-20  4:09       ` Cyrille Lefevre
2011-01-28 19:38   ` Jeremy C. Reed
2011-01-30 15:05     ` Sven Mascheck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110116132039.GA16484@lisa.in-ulm.de \
    --to=mascheck@in-ulm.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).