Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site rtech.ARPA Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!vax135!cornell!uw-beaver!tektronix!zehntel!vlsvax1!qantel!dual!unisoft!mtxinu!rtech!roger From: roger@rtech.ARPA (Roger Rohrbach) Newsgroups: net.unix,net.unix-wizards Subject: Re: "#! /bin/sh" vs ":" Message-ID: <374@rtech.ARPA> Date: Fri, 10-May-85 19:06:39 EDT Article-I.D.: rtech.374 Posted: Fri May 10 19:06:39 1985 Date-Received: Tue, 14-May-85 23:46:48 EDT References: <183@ski.UUCP> Organization: Relational Technology, Berkeley CA Lines: 22 Xref: watmath net.unix:4501 net.unix-wizards:13160 > But what's really happening here? The "#!/bin/sh" trick only works on 4.2BSD and derivatives; it's actually a magic number for the execve() system call, and is a generalized way of invoking the correct interpreter for a file. In other words, a Franz Lisp program in a file named "prog" which has been made executable and which starts with the line: #!/usr/ucb/lisp can be run by typing "prog". If you are running csh on a non-BSD Unix system, the way to ensure that a file is interpreted by /bin/sh is to make certain that its first character is not a '#'. Even a file beginning "#!/bin/sh" will not be interpreted by sh on such a system, since this is simply an ordinary comment. Alternatively, if you set the 'shell' variable to "/bin/sh", all shell scripts will be interpreted by sh. Roger Rohrbach {ucbvax,decvax}!mtxinu!rtech!roger