Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!jsq From: guy@auspex.uucp (Guy Harris) Newsgroups: comp.std.unix Subject: Re: Shell standardization (for c.std.unix) Message-ID: <17398@cs.utexas.edu> Date: 22 Jan 91 21:28:49 GMT References: <17011@cs.utexas.edu> <17065@cs.utexas.edu> <17155@cs.utexas.edu> Sender: jsq@cs.utexas.edu Organization: Auspex Systems, Santa Clara Lines: 29 Approved: jsq@cs.utexas.edu (Moderator, John S. Quarterman) X-Submissions: std-unix@uunet.uu.net Submitted-by: guy@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