The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Brian Walden <tuhs@cuzuco.com>
To: <tuhs@minnie.tuhs.org>
Subject: [TUHS] # (was Re: sh: cmd | >file)
Date: Mon, 6 Jan 2020 01:30:07 -0500 (EST)	[thread overview]
Message-ID: <202001060630.0066U7U7023760@cuzuco.com> (raw)

A bit more on this.
csh(1) was wrtten around 1978 and yes # as a comment was only for
scrtipts, think it was why would you need to comment interactively?
And the # as an addition to be a comment in Bourne shell had to be around 1980
as that is when Dennis Ritchie added #! to exec(2) in the kernel. From this
point on this forced all UNIX scripting languages to use # as a comment as
it just exec'd the first string after the #! with the name of the current
file being exec'd as the single argument. So things like perl(1) and python(1)
had to use # if they wanted the #! mechanism to work for them too.

So this worked great for shell scripts, it didn't work for awk(1) nor sed(1)
nor s(1)(that is R(1) now) scripts (all needed a -f for input from file)
nor dc(1) scripts as dc had no comment character.
While Research UNIX got !# in 1980, this was after the 7th Edition release
and the 8th Edition wasn't released until 1985), BSD got it around 1982-83,
and System V didn't implement it until 1988. Eventully #! was extented
so #!/usr/bin/awk -f would work.

Also Bill Joy was the first to use # as a comment character in an /etc config
file for his /etc/ttycap (which became /etc/termcap) for vi(1). Most configs
did not have a comment at all at that time, while /etc/master used a * as a
comment (SCCS used * as a comment too btw)

Also before you say wait! ALGOL uses # as comment and is older than
Kernighan' ratfor(1). This is a later addition. The original used the EBCDIC
cent sign character to start and another cent sign to end the comment
(i.e. programmer's two cents). If you were on an ASCII system this became
"co" (for comment) as the original ASCII does not have a cent sign

-Brian

             reply	other threads:[~2020-01-06  6:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06  6:30 Brian Walden [this message]
2020-01-06 22:50 ` Dave Horsfall
2020-01-07  0:39   ` Warner Losh
2020-01-08  2:44     ` Greg A. Woods
2020-01-07 15:24   ` Clem Cole
2020-01-07 22:13     ` Dave Horsfall
2020-01-07 22:26   ` Bakul Shah
2020-01-07 22:56     ` Dave Horsfall
2020-01-08  5:20 Brian Walden
2020-01-08  6:25 ` Bakul Shah

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=202001060630.0066U7U7023760@cuzuco.com \
    --to=tuhs@cuzuco.com \
    --cc=tuhs@minnie.tuhs.org \
    /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).