Re: The right way to invoke sh from a freebsd makefile?

From: Glen Barber <gjb_at_FreeBSD.org>
Date: Sun, 22 Sep 2013 20:02:48 -0400
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


Received on Sun Sep 22 2013 - 22:02:50 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:41 UTC