[TUHS] Bourne shell and comments

Steffen Nurpmeso steffen at sdaoden.eu
Thu Apr 20 08:07:28 AEST 2017

Sven Mascheck <mascheck at in-ulm.de> wrote:
 |On Wed, Apr 19, 2017 at 06:48:34AM +1000, Warren Toomey wrote:
 |> I was trying to configure C news on 2.9BSD today and I found that its
 |> Bourne shell doesn't grok # comments. The Bourne shell in 2.11BSD does.
 |> So I thought: when did the Bourne (and other) shells first grok # as
 |> indicating a comment? Was this in response to #! being added to the
 |> kernel, or was it the other way around? And was the choice of #!
 |> arbitrary, or was it borrowed from somewhere else?
 |> Datum point: 2.9BSD's kernel can recognise #!, but the sh can't recognise \
 |> #.
 |Dennis' email about #! to Berkeley is dated Jan 10 '80.
 |I've never seen any hint, how the bang in #! was chosen. Looks racy \
 |at least..
 |#! on BSDs was available as compile time option in 4.0BSD (~Oct '80?)
 |and default on 4.2BSD (~Sep '83).
 |BTW, AFAIK, the #! implementation in 2.8BSD (compile time option) is not
 |from research but seems to come from U.S. Geological Survey, Menlo Park.
 |The BSD csh hack in sh&csh (# special as first character in a file, \
 |came with 3BSD, also in '80.
 |I found # as comment character in the BSD-sh first in CSRG 4.1.snap
 |(~Apr '81, word.c). And at Bell Labs, as mentioned, it came with SysIII, \
 |also ~81.
 |BTW, 4.3BSD ('86), and thus 2.10 BSD, brought an interesting change:
 |# is only recognized in non-interactive mode. In interactive mode
 |you actually get this:
 |  $ # echo x
 |  #: not found
 |This was not changed in 4BSD until sh was replaced by ash in 4.3 Net/2.

Hmm.  Kurt Shoens added # as a null() saying "The do nothing
command for comments." before that (2BSD, file copyright 1979).


More information about the TUHS mailing list