From mboxrd@z Thu Jan 1 00:00:00 1970 From: mascheck@in-ulm.de (Sven Mascheck) Date: Sun, 16 Jan 2011 20:19:42 +0100 Subject: [TUHS] History of #! interpretation in Unix In-Reply-To: <20110116171715.GD3374@mercury.ccil.org> References: <20110116084330.GA27396@minnie.tuhs.org> <20110116095548.GC3374@mercury.ccil.org> <20110116132039.GA16484@lisa.in-ulm.de> <20110116171715.GD3374@mercury.ccil.org> Message-ID: <20110116191942.GA26424@lisa.in-ulm.de> John Cowan wrote: > Sven Mascheck scripsit: > > > 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. > > No, that would be too much of a coincidence to choose exactly the > same characters. There has to be a single point of origin, from > which it spread by stimulus diffusion (you hear there are telescopes, > you know they use lenses, you build your own telescope). This doesn't sound obligatory to me (I know it's academic). DMR might have known the csh-hack (and if a comment character is implemented anywhere, here csh, then it's obvious to use it for #!) > > 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"? > > Yes, seemingly bash does that too. Bogus. How'd you get the impression? I can't verify this. bash-1.05:execute_cmd.c executed the commands itself, in a subshell, " [ errno == ENOEXEC ] /* This file is executable. If it begins with #!, then help out people with losing operating systems. Otherwise, check to see if it is a binary file by seeing if the first line (or upto 30 characters) are in the ASCII set. Execute the contents as shell commands. */ " and this hasn't been changed (except length or return status) until the current release. Perhaps you had another shell in mind? I believe a shell should try to execute commands itself instead of calling any other shell. (That's the only way how executing on in POSIX shell is possible, BTW, because neither #! nor paths are standardized).