Newsgroups: comp.os.minix Path: utzoo!utgpu!watserv1!watmath!mks.com!sean From: sean@mks.com (Sean Goggin) Subject: Re: executable scripts? Date: Fri, 3 May 91 15:10:50 GMT Message-ID: <1991May3.151050.6356@mks.com> Organization: Mortice Kern Systems, Waterloo, Ontario, CANADA Reply-To: sean@watcsc.uwaterloo.ca Sender: Sean Goggin Summary: #!/bin/sh and Posix 1003.2 In article <10120@plains.NoDak.edu> overby@plains.NoDak.edu (Glen Overby) writes >In article klamer@mi.eltn.utwente.nl (Klamer Schutte) writes: >>However, a proper shell >>should<< look at the first two characters of a >>script it gets (when the script is executable). Since minix sh does not, > >I disagree. The shell should not be looking at executables; it should >merely "exec" them and the kernel should determine what is REALLY done with >the executable, be it loaded as a binary image or fed through an interpreter. > >By requiring the "shell" to check for executable scripts, you complicate any >program which chooses to use exec(2) since it, too, must open the executable >and check for an interpreter. Any executable should be "exec"-able. I hope this helps. Command search and execution 3.9.1.1 P1003.2/D10 p178 line 1075-1079 System API [C language] P1003.1/D05 p12 line 53-54 If execve() fails due to an error equivalent to ENOEXEC the shell shall execute a command equivalent to having a shell invoked with the command name as its first operand, long with any remaining arguments. ENOEXEC = new process image file has access permission, but has an unrecognized format. Sean Goggin -- Sean.Goggin..sean@mks.com.............Mortice.Kern.Systems.Waterloo.Ontario.Can.