Shell standardization (for c.std.unix)

Guy Harris guy at auspex.uucp
Wed Jan 23 08:28:49 AEST 1991


Submitted-by: guy at auspex.uucp (Guy Harris)

>Currently, when the kernel returns ENOEXEC the shell just blindly assumes
>that we have a shell script here and starts executing it. I don't see
>any problem in the shell reading the first line and checking it for
>#!/bin/sh.

Or checking for "#!" in general, and doing what is done in the "exec*()"
implementations of many systems (usually in the kernel, but not
necessarily so) - i.e., have the Bourne shell capable of executing C
shell scripts (for those of you who write them :-)) that begin with "#!
/bin/csh", and the C shell capable of executing Bourne shell scripts
that begin with "#! /bin/sh", etc..

I don't strongly care where it's done (although I *do* prefer having
"execl()" AND "execv()" capable of running scripts, even if it's done by
having them be wrappers around kernel traps with the wrappers checking
for the "#!" line if they get ENOEXEC), but it *would* be nice if the
system didn't inappropriately try to run files that happened to have
execute permissions as scripts if, in fact, they aren't scripts. 

I don't know if anything more should be said by any standard than simply
"we do not guarantee that any shell will execute a script that doesn't
begin with '#!'", so that you can remove the "if it gets ENOEXEC, treat
it as a script" stuff and still comply with the appropriate POSIX
standard(s).


Volume-Number: Volume 22, Number 79



More information about the Comp.std.unix mailing list