"#! /bin/sh" vs ":"
Roger Rohrbach
roger at rtech.ARPA
Sat May 11 09:06:39 AEST 1985
> 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
More information about the Comp.unix.wizards
mailing list