[TUHS] Shell control through external commands

arnold at skeeve.com arnold at skeeve.com
Sun Sep 11 05:22:48 AEST 2016


Dario Niedermann <dnied at tiscali.it> wrote:

> I never knew that a shell script could work without a shebang line.

That was the simplicity of the original system, where you just made the
file executable. The shell would fork and exec as usual.  When the exec
failed, the shell noticed that errno was ENOEXEC (not a runnable file)
and started interpreting the script itself.

This broke down as soon as there were two shells (/bin/sh and csh) since
if you tried to run a csh script from the Bourne shell or vice versa,
things weirded out pretty quickly.

IIRC #! originated at Bell Labs but it got out to the world via BSD.
Perhaps Dr. McIlroy could confirm / deny / expand upon the details (please?)

Thanks,

Arnold



More information about the TUHS mailing list