From the horse’s mouth (as per https://www.talisman.org/~erlkonig/documents/dennis-ritchie-and-hash-bang.shtml ):

From: "Ritchie, Dennis M (Dennis)** CTR **" <dmr@research.bell-labs.com> To: <erlĸonigⓐtαlismαn.org> Date: Thu, 19 Nov 2009 18:37:37 -0600 Subject: RE: What do -you- call your #!<something> line? I can't recall that we ever gave it a proper name. It was pretty late that it went in--I think that I got the idea from someone at one of the UCB conferences on Berkeley Unix; I may have been one of the first to actually install it, but it was an idea that I got from elsewhere. As for the name: probably something descriptive like "hash-bang" though this has a specifically British flavor, but in any event I don't recall particularly using a pet name for the construction. Regards, Dennis

[Sorry about the html]

On Apr 20, 2017, at 8:28 PM, arnold@skeeve.com wrote:

Clem Cole <clemc@ccc.com> wrote:

below...

On Tue, Apr 18, 2017 at 4:51 PM, Ron Natalie <ron@ronnatalie.com> wrote:

I believe the Berkeley #! magic number came first.

That's right.... the #!path syntax was BSDism that went main stream
because of its usefulness with "little languages" not just the shell.
I'd have to check the tapes but it may have gone back as far as the
original BSD ~77/78 - Ken would have brought it back after his sabbatical
(or not - he would have seen it).

I thought it was pretty well established that DMR invented it and
told the UCB guys about it? There's an email in the archives from
him, too.

Dr. McIlroy? Can you clarify?

The # was nod to the # being the first characters of the C program to say
to use the preprocessor; but I've forgotten why the bang was added before
the path.    It could have been almost anything.

Perhaps reminiscent of the '!' escape to shell in ed and maybe
some other interactive programs of the time?  That's purely a guess
on my part.

My two cents,

Arnold