On 6 November 2012 04:54, Andrew Stubbs <a...@codesourcery.com> wrote:
> While it is true that "/usr/bin/env bash" is more portable than "/bin/bash",
> I also don't like it as much.
> If I run a "#!/bin/bash" script without bash installed I get:
>   /bin/bash: bad interpreter: No such file or directory
> If I try the same with "#!/usr/bin/env bash" I get:
>   /bin/env: bad interpreter: No such file or directory

Perhaps you should get a better version of env?
I get:

[10026 eitan@radar ~ ]%./hello
env: asdf: No such file or directory
[10027 eitan@radar ~ !127!]%cat hello
#!/usr/bin/env asdf

> In the former case any mildly experienced Unix user will just sigh and run
> the script under bash manually. In the later case you have to be very
> experienced not to spend ages thinking you must be crazy or have found a
> kernel bug, or something.

In the former case the package maintainers must fix the portability
bug the upstream author has introduced.
In the latter case they just have to add a dependency.

> It is, of course, the official Ccache maintainer's call which style is
> preferred, or even whether it's better to find and stamp out the errant
> bashism in the script, but my vote is for the simple /bin/bash option.

The followup to this discussion indicates that /bin/sh seems to be
sufficient (I need to check this myself when I get a chance).
checkbashims sees nothing wrong.

Eitan Adler
ccache mailing list

Reply via email to