The right way to invoke sh from a freebsd makefile?

Glen Barber gjb at FreeBSD.org
Mon Sep 23 00:02:51 UTC 2013


On Sun, Sep 22, 2013 at 05:56:07PM -0600, Ian Lepore wrote:
> > You can hard-code /bin/sh directly, but what I was getting at with the
> > '#!/usr/bin/env sh' is that the 'sh' interpreter of the build
> > environment could be used (instead of /bin/sh directly).  Then you don't
> > need to worry about the path to sh(1).
> > 
> 
> My point is that the #! isn't used at all in this case, it doesn't
> matter what's there.  Try this...
> 
>   echo "echo foo" >/tmp/foo
>   sh /tmp/foo
> 
> Not only does it not need the hashbang, the script doesn't even have to
> be executable when you launch sh and name a script on the command line,
> which is just what's needed to run a script from a directory mounted
> with the noexec flag.
> 

Ah - maybe it's just late.  I see what you mean now.  Thanks.

Glen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20130922/fb88b397/attachment.sig>


More information about the freebsd-hackers mailing list